mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Implement column aliases on views "CREATE VIEW name (collist)".
Implement TIME WITH TIME ZONE type (timetz internal type). Remap length() for character strings to CHAR_LENGTH() for SQL92 and to remove the ambiguity with geometric length() functions. Keep length() for character strings for backward compatibility. Shrink stored views by removing internal column name list from visible rte. Implement min(), max() for time and timetz data types. Implement conversion of TIME to INTERVAL. Implement abs(), mod(), fac() for the int8 data type. Rename some math functions to generic names: round(), sqrt(), cbrt(), pow(), etc. Rename NUMERIC power() function to pow(). Fix int2 factorial to calculate result in int4. Enhance the Oracle compatibility function translate() to work with string arguments (from Edwin Ramirez). Modify pg_proc system table to remove OID holes.
This commit is contained in:
@ -291,5 +291,7 @@ DELETE FROM tmp3 where a=5;
|
||||
-- Try (and succeed)
|
||||
ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 match full;
|
||||
NOTICE: ALTER TABLE ... ADD CONSTRAINT will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
DROP TABLE tmp3
|
||||
DROP TABLE tmp2
|
||||
DROP TABLE tmp3;
|
||||
NOTICE: DROP TABLE implicitly drops referential integrity trigger from table "tmp2"
|
||||
NOTICE: DROP TABLE implicitly drops referential integrity trigger from table "tmp2"
|
||||
DROP TABLE tmp2;
|
||||
|
@ -36,7 +36,7 @@ SELECT '' AS four, BOX_TBL.*;
|
||||
| (3,3),(3,3)
|
||||
(4 rows)
|
||||
|
||||
SELECT '' AS four, b.*, box_area(b.f1) as barea
|
||||
SELECT '' AS four, b.*, area(b.f1) as barea
|
||||
FROM BOX_TBL b;
|
||||
four | f1 | barea
|
||||
------+---------------------+-------
|
||||
|
@ -40,7 +40,7 @@ ERROR: Attribute 'foobar' not found
|
||||
|
||||
-- missing relation name (this had better not wildcard!)
|
||||
delete from;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- no such relation
|
||||
delete from nonesuch;
|
||||
ERROR: Relation 'nonesuch' does not exist
|
||||
@ -49,7 +49,7 @@ ERROR: Relation 'nonesuch' does not exist
|
||||
|
||||
-- missing relation name (this had better not wildcard!)
|
||||
drop table;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- no such relation
|
||||
drop table nonesuch;
|
||||
ERROR: Relation 'nonesuch' does not exist
|
||||
@ -59,7 +59,7 @@ ERROR: Relation 'nonesuch' does not exist
|
||||
-- relation renaming
|
||||
-- missing relation name
|
||||
alter table rename;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- no such relation
|
||||
alter table nonesuch rename to newnonesuch;
|
||||
ERROR: Relation 'nonesuch' does not exist
|
||||
@ -144,7 +144,7 @@ ERROR: AggregateCreate: transition function 2 MUST have an initial value
|
||||
|
||||
-- missing index name
|
||||
drop index;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- bad index name
|
||||
drop index 314159;
|
||||
ERROR: parser: parse error at or near "314159"
|
||||
@ -156,16 +156,16 @@ ERROR: index "nonesuch" nonexistent
|
||||
|
||||
-- missing aggregate name
|
||||
drop aggregate;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- bad aggregate name
|
||||
drop aggregate 314159;
|
||||
ERROR: parser: parse error at or near "314159"
|
||||
-- no such aggregate
|
||||
drop aggregate nonesuch;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- missing aggregate type
|
||||
drop aggregate newcnt1;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- bad aggregate type
|
||||
drop aggregate newcnt nonesuch;
|
||||
ERROR: RemoveAggregate: type 'nonesuch' does not exist
|
||||
@ -189,7 +189,7 @@ ERROR: RemoveFunction: function 'nonesuch()' does not exist
|
||||
|
||||
-- missing type name
|
||||
drop type;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- bad type name
|
||||
drop type 314159;
|
||||
ERROR: parser: parse error at or near "314159"
|
||||
@ -201,13 +201,13 @@ ERROR: RemoveType: type 'nonesuch' does not exist
|
||||
|
||||
-- missing everything
|
||||
drop operator;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- bad operator name
|
||||
drop operator equals;
|
||||
ERROR: parser: parse error at or near "equals"
|
||||
-- missing type list
|
||||
drop operator ===;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- missing parentheses
|
||||
drop operator int4, int4;
|
||||
ERROR: parser: parse error at or near "int4"
|
||||
@ -243,7 +243,7 @@ ERROR: parser: parse error at or near ")"
|
||||
|
||||
-- missing rule name
|
||||
drop rule;
|
||||
ERROR: parser: parse error at or near ""
|
||||
ERROR: parser: parse error at or near ";"
|
||||
-- bad rule name
|
||||
drop rule 314159;
|
||||
ERROR: parser: parse error at or near "314159"
|
||||
|
@ -149,7 +149,19 @@ SELECT '' AS five, f.f1, f.f1 % AS round_f1
|
||||
| 1.2345678901234e-200 | 0
|
||||
(5 rows)
|
||||
|
||||
SELECT sqrt(float8 '64') AS eight;
|
||||
eight
|
||||
-------
|
||||
8
|
||||
(1 row)
|
||||
|
||||
-- square root
|
||||
SELECT |/ float8 '64' AS eight;
|
||||
eight
|
||||
-------
|
||||
8
|
||||
(1 row)
|
||||
|
||||
SELECT '' AS three, f.f1, |/f.f1 AS sqrt_f1
|
||||
FROM FLOAT8_TBL f
|
||||
WHERE f.f1 > '0.0';
|
||||
@ -172,6 +184,12 @@ SELECT '' AS three, f.f1, : ( ; f.f1) AS exp_ln_f1
|
||||
(3 rows)
|
||||
|
||||
-- cube root
|
||||
SELECT ||/ float8 '27' AS three;
|
||||
three
|
||||
-------
|
||||
3
|
||||
(1 row)
|
||||
|
||||
SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f;
|
||||
five | f1 | cbrt_f1
|
||||
------+----------------------+----------------------
|
||||
@ -217,7 +235,7 @@ SELECT '' AS five, FLOAT8_TBL.*;
|
||||
| -1.2345678901234e-200
|
||||
(5 rows)
|
||||
|
||||
-- test for over and under flow
|
||||
-- test for over- and underflow
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
|
||||
ERROR: Input '10e400' is out of range for float8
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
|
||||
|
@ -150,11 +150,11 @@ SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;
|
||||
six | box
|
||||
-----+----------------------------------------------------------------------------
|
||||
| (2.12132034355964,2.12132034355964),(-2.12132034355964,-2.12132034355964)
|
||||
| (71.7106781186547,72.7106781186547),(-69.7106781186547,-68.7106781186547)
|
||||
| (4.53553390593274,6.53553390593274),(-2.53553390593274,-0.535533905932737)
|
||||
| (71.7106781186548,72.7106781186548),(-69.7106781186548,-68.7106781186548)
|
||||
| (4.53553390593274,6.53553390593274),(-2.53553390593274,-0.535533905932738)
|
||||
| (3.12132034355964,4.12132034355964),(-1.12132034355964,-0.121320343559642)
|
||||
| (107.071067811865,207.071067811865),(92.9289321881345,192.928932188135)
|
||||
| (170.710678118655,70.7106781186547),(29.2893218813453,-70.7106781186547)
|
||||
| (170.710678118655,70.7106781186548),(29.2893218813452,-70.7106781186548)
|
||||
(6 rows)
|
||||
|
||||
-- translation
|
||||
@ -280,7 +280,7 @@ SELECT '' AS twenty, b.f1 / p.f1 AS rotation
|
||||
-- Paths
|
||||
--
|
||||
SET geqo TO 'off';
|
||||
SELECT '' AS eight, points(f1) AS npoints, f1 AS path FROM PATH_TBL;
|
||||
SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL;
|
||||
eight | npoints | path
|
||||
-------+---------+---------------------------
|
||||
| 2 | [(1,2),(3,4)]
|
||||
@ -397,7 +397,7 @@ SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 @ poly.f1 AS contained
|
||||
| (10,10) | ((0,1),(0,1)) | f
|
||||
(24 rows)
|
||||
|
||||
SELECT '' AS four, points(f1) AS npoints, f1 AS polygon
|
||||
SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon
|
||||
FROM POLYGON_TBL;
|
||||
four | npoints | polygon
|
||||
------+---------+---------------------
|
||||
@ -502,31 +502,31 @@ SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS d
|
||||
FROM CIRCLE_TBL c1, POINT_TBL p1
|
||||
WHERE (p1.f1 <-> c1.f1) > 0
|
||||
ORDER BY distance, circle, point using <<;
|
||||
twentyfour | circle | point | distance
|
||||
------------+----------------+------------+------------------
|
||||
| <(100,0),100> | (5.1,34.5) | 0.97653192697797
|
||||
| <(1,2),3> | (-3,4) | 1.47213595499958
|
||||
| <(0,0),3> | (-3,4) | 2
|
||||
| <(100,0),100> | (-3,4) | 3.07764064044152
|
||||
| <(100,0),100> | (-5,-12) | 5.68348972285122
|
||||
| <(1,3),5> | (-10,0) | 6.40175425099138
|
||||
| <(1,3),5> | (10,10) | 6.40175425099138
|
||||
| <(0,0),3> | (-10,0) | 7
|
||||
| <(1,2),3> | (-10,0) | 8.18033988749895
|
||||
| <(1,2),3> | (10,10) | 9.0415945787923
|
||||
| <(0,0),3> | (-5,-12) | 10
|
||||
| <(100,0),100> | (-10,0) | 10
|
||||
| <(0,0),3> | (10,10) | 11.142135623731
|
||||
| <(1,3),5> | (-5,-12) | 11.1554944214035
|
||||
| <(1,2),3> | (-5,-12) | 12.2315462117278
|
||||
| <(1,3),5> | (5.1,34.5) | 26.7657047773223
|
||||
| <(1,2),3> | (5.1,34.5) | 29.757594539282
|
||||
| <(0,0),3> | (5.1,34.5) | 31.8749193547455
|
||||
| <(100,200),10> | (5.1,34.5) | 180.778038568384
|
||||
| <(100,200),10> | (10,10) | 200.237960416286
|
||||
| <(100,200),10> | (-3,4) | 211.415898254845
|
||||
| <(100,200),10> | (0,0) | 213.606797749979
|
||||
| <(100,200),10> | (-10,0) | 218.254244210267
|
||||
| <(100,200),10> | (-5,-12) | 226.577682802077
|
||||
twentyfour | circle | point | distance
|
||||
------------+----------------+------------+-------------------
|
||||
| <(100,0),100> | (5.1,34.5) | 0.976531926977965
|
||||
| <(1,2),3> | (-3,4) | 1.47213595499958
|
||||
| <(0,0),3> | (-3,4) | 2
|
||||
| <(100,0),100> | (-3,4) | 3.07764064044151
|
||||
| <(100,0),100> | (-5,-12) | 5.68348972285122
|
||||
| <(1,3),5> | (-10,0) | 6.40175425099138
|
||||
| <(1,3),5> | (10,10) | 6.40175425099138
|
||||
| <(0,0),3> | (-10,0) | 7
|
||||
| <(1,2),3> | (-10,0) | 8.18033988749895
|
||||
| <(1,2),3> | (10,10) | 9.0415945787923
|
||||
| <(0,0),3> | (-5,-12) | 10
|
||||
| <(100,0),100> | (-10,0) | 10
|
||||
| <(0,0),3> | (10,10) | 11.142135623731
|
||||
| <(1,3),5> | (-5,-12) | 11.1554944214035
|
||||
| <(1,2),3> | (-5,-12) | 12.2315462117278
|
||||
| <(1,3),5> | (5.1,34.5) | 26.7657047773223
|
||||
| <(1,2),3> | (5.1,34.5) | 29.757594539282
|
||||
| <(0,0),3> | (5.1,34.5) | 31.8749193547455
|
||||
| <(100,200),10> | (5.1,34.5) | 180.778038568384
|
||||
| <(100,200),10> | (10,10) | 200.237960416286
|
||||
| <(100,200),10> | (-3,4) | 211.415898254845
|
||||
| <(100,200),10> | (0,0) | 213.606797749979
|
||||
| <(100,200),10> | (-10,0) | 218.254244210267
|
||||
| <(100,200),10> | (-5,-12) | 226.577682802077
|
||||
(24 rows)
|
||||
|
||||
|
@ -295,21 +295,3 @@ SELECT (2 + 2) / 2 AS two;
|
||||
2
|
||||
(1 row)
|
||||
|
||||
SELECT dsqrt(float8 '64') AS eight;
|
||||
eight
|
||||
-------
|
||||
8
|
||||
(1 row)
|
||||
|
||||
SELECT |/float8 '64' AS eight;
|
||||
eight
|
||||
-------
|
||||
8
|
||||
(1 row)
|
||||
|
||||
SELECT ||/float8 '27' AS three;
|
||||
three
|
||||
-------
|
||||
3
|
||||
(1 row)
|
||||
|
||||
|
@ -646,10 +646,10 @@ SELECT t1.id1, t1.result, t2.expected
|
||||
(0 rows)
|
||||
|
||||
-- ******************************
|
||||
-- * POWER(10, LN(value)) check
|
||||
-- * POW(10, LN(value)) check
|
||||
-- ******************************
|
||||
DELETE FROM num_result;
|
||||
INSERT INTO num_result SELECT id, 0, POWER(numeric '10', LN(ABS(round(val,200))))
|
||||
INSERT INTO num_result SELECT id, 0, POW(numeric '10', LN(ABS(round(val,200))))
|
||||
FROM num_data
|
||||
WHERE val != '0.0';
|
||||
SELECT t1.id1, t1.result, t2.expected
|
||||
|
@ -1147,27 +1147,27 @@ SELECT * FROM shoelace ORDER BY sl_name;
|
||||
-- Check that ruleutils are working
|
||||
--
|
||||
SELECT viewname, definition FROM pg_views ORDER BY viewname;
|
||||
viewname | definition
|
||||
--------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
iexit | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih (name, thepath), ramp r (name, thepath) WHERE (ih.thepath ## r.thepath);
|
||||
pg_indexes | SELECT c.relname AS tablename, i.relname AS indexname, pg_get_indexdef(x.indexrelid) AS indexdef FROM pg_index x (indexrelid, indrelid, indproc, indkey, indclass, indisclustered, indislossy, indhaskeytype, indisunique, indisprimary, indreference, indpred), pg_class c (relname, reltype, relowner, relam, relpages, reltuples, rellongrelid, relhasindex, relisshared, relkind, relnatts, relchecks, reltriggers, relukeys, relfkeys, relrefs, relhaspkey, relhasrules, relacl), pg_class i (relname, reltype, relowner, relam, relpages, reltuples, rellongrelid, relhasindex, relisshared, relkind, relnatts, relchecks, reltriggers, relukeys, relfkeys, relrefs, relhaspkey, relhasrules, relacl) WHERE ((c.oid = x.indrelid) AND (i.oid = x.indexrelid));
|
||||
pg_rules | SELECT c.relname AS tablename, r.rulename, pg_get_ruledef(r.rulename) AS definition FROM pg_rewrite r (rulename, ev_type, ev_class, ev_attr, is_instead, ev_qual, ev_action), pg_class c (relname, reltype, relowner, relam, relpages, reltuples, rellongrelid, relhasindex, relisshared, relkind, relnatts, relchecks, reltriggers, relukeys, relfkeys, relrefs, relhaspkey, relhasrules, relacl) WHERE ((r.rulename !~ '^_RET'::text) AND (c.oid = r.ev_class));
|
||||
pg_tables | SELECT c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, c.relhasindex AS hasindexes, c.relhasrules AS hasrules, (c.reltriggers > 0) AS hastriggers FROM pg_class c (relname, reltype, relowner, relam, relpages, reltuples, rellongrelid, relhasindex, relisshared, relkind, relnatts, relchecks, reltriggers, relukeys, relfkeys, relrefs, relhaspkey, relhasrules, relacl) WHERE (((c.relkind = 'r'::"char") OR (c.relkind = 's'::"char")) AND (NOT (EXISTS (SELECT pg_rewrite.rulename FROM pg_rewrite WHERE ((pg_rewrite.ev_class = c.oid) AND (pg_rewrite.ev_type = '1'::"char"))))));
|
||||
viewname | definition
|
||||
--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
iexit | SELECT ih.name, ih.thepath, interpt_pp(ih.thepath, r.thepath) AS exit FROM ihighway ih, ramp r WHERE (ih.thepath ## r.thepath);
|
||||
pg_indexes | SELECT c.relname AS tablename, i.relname AS indexname, pg_get_indexdef(x.indexrelid) AS indexdef FROM pg_index x, pg_class c, pg_class i WHERE ((c.oid = x.indrelid) AND (i.oid = x.indexrelid));
|
||||
pg_rules | SELECT c.relname AS tablename, r.rulename, pg_get_ruledef(r.rulename) AS definition FROM pg_rewrite r, pg_class c WHERE ((r.rulename !~ '^_RET'::text) AND (c.oid = r.ev_class));
|
||||
pg_tables | SELECT c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, c.relhasindex AS hasindexes, c.relhasrules AS hasrules, (c.reltriggers > 0) AS hastriggers FROM pg_class c WHERE (((c.relkind = 'r'::"char") OR (c.relkind = 's'::"char")) AND (NOT (EXISTS (SELECT pg_rewrite.rulename FROM pg_rewrite WHERE ((pg_rewrite.ev_class = c.oid) AND (pg_rewrite.ev_type = '1'::"char"))))));
|
||||
pg_user | SELECT pg_shadow.usename, pg_shadow.usesysid, pg_shadow.usecreatedb, pg_shadow.usetrace, pg_shadow.usesuper, pg_shadow.usecatupd, '********'::text AS passwd, pg_shadow.valuntil FROM pg_shadow;
|
||||
pg_views | SELECT c.relname AS viewname, pg_get_userbyid(c.relowner) AS viewowner, pg_get_viewdef(c.relname) AS definition FROM pg_class c (relname, reltype, relowner, relam, relpages, reltuples, rellongrelid, relhasindex, relisshared, relkind, relnatts, relchecks, reltriggers, relukeys, relfkeys, relrefs, relhaspkey, relhasrules, relacl) WHERE (c.relhasrules AND (EXISTS (SELECT r.rulename FROM pg_rewrite r (rulename, ev_type, ev_class, ev_attr, is_instead, ev_qual, ev_action) WHERE ((r.ev_class = c.oid) AND (r.ev_type = '1'::"char")))));
|
||||
pg_views | SELECT c.relname AS viewname, pg_get_userbyid(c.relowner) AS viewowner, pg_get_viewdef(c.relname) AS definition FROM pg_class c WHERE (c.relhasrules AND (EXISTS (SELECT r.rulename FROM pg_rewrite r WHERE ((r.ev_class = c.oid) AND (r.ev_type = '1'::"char")))));
|
||||
rtest_v1 | SELECT rtest_t1.a, rtest_t1.b FROM rtest_t1;
|
||||
rtest_vcomp | SELECT x.part, (x.size * y.factor) AS size_in_cm FROM rtest_comp x (part, unit, size), rtest_unitfact y (unit, factor) WHERE (x.unit = y.unit);
|
||||
rtest_vview1 | SELECT x.a, x.b FROM rtest_view1 x (a, b, v) WHERE (0 < (SELECT count(*) AS count FROM rtest_view2 y (a) WHERE (y.a = x.a)));
|
||||
rtest_vcomp | SELECT x.part, (x.size * y.factor) AS size_in_cm FROM rtest_comp x, rtest_unitfact y WHERE (x.unit = y.unit);
|
||||
rtest_vview1 | SELECT x.a, x.b FROM rtest_view1 x WHERE (0 < (SELECT count(*) AS count FROM rtest_view2 y WHERE (y.a = x.a)));
|
||||
rtest_vview2 | SELECT rtest_view1.a, rtest_view1.b FROM rtest_view1 WHERE rtest_view1.v;
|
||||
rtest_vview3 | SELECT x.a, x.b FROM rtest_vview2 x (a, b) WHERE (0 < (SELECT count(*) AS count FROM rtest_view2 y (a) WHERE (y.a = x.a)));
|
||||
rtest_vview4 | SELECT x.a, x.b, count(y.a) AS refcount FROM rtest_view1 x (a, b, v), rtest_view2 y (a) WHERE (x.a = y.a) GROUP BY x.a, x.b;
|
||||
rtest_vview3 | SELECT x.a, x.b FROM rtest_vview2 x WHERE (0 < (SELECT count(*) AS count FROM rtest_view2 y WHERE (y.a = x.a)));
|
||||
rtest_vview4 | SELECT x.a, x.b, count(y.a) AS refcount FROM rtest_view1 x, rtest_view2 y WHERE (x.a = y.a) GROUP BY x.a, x.b;
|
||||
rtest_vview5 | SELECT rtest_view1.a, rtest_view1.b, rtest_viewfunc1(rtest_view1.a) AS refcount FROM rtest_view1;
|
||||
shoe | SELECT sh.shoename, sh.sh_avail, sh.slcolor, sh.slminlen, (sh.slminlen * un.un_fact) AS slminlen_cm, sh.slmaxlen, (sh.slmaxlen * un.un_fact) AS slmaxlen_cm, sh.slunit FROM shoe_data sh (shoename, sh_avail, slcolor, slminlen, slmaxlen, slunit), unit un (un_name, un_fact) WHERE (sh.slunit = un.un_name);
|
||||
shoe_ready | SELECT rsh.shoename, rsh.sh_avail, rsl.sl_name, rsl.sl_avail, int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail FROM shoe rsh (shoename, sh_avail, slcolor, slminlen, slminlen_cm, slmaxlen, slmaxlen_cm, slunit), shoelace rsl (sl_name, sl_avail, sl_color, sl_len, sl_unit, sl_len_cm) WHERE (((rsl.sl_color = rsh.slcolor) AND (rsl.sl_len_cm >= rsh.slminlen_cm)) AND (rsl.sl_len_cm <= rsh.slmaxlen_cm));
|
||||
shoelace | SELECT s.sl_name, s.sl_avail, s.sl_color, s.sl_len, s.sl_unit, (s.sl_len * u.un_fact) AS sl_len_cm FROM shoelace_data s (sl_name, sl_avail, sl_color, sl_len, sl_unit), unit u (un_name, un_fact) WHERE (s.sl_unit = u.un_name);
|
||||
shoe | SELECT sh.shoename, sh.sh_avail, sh.slcolor, sh.slminlen, (sh.slminlen * un.un_fact) AS slminlen_cm, sh.slmaxlen, (sh.slmaxlen * un.un_fact) AS slmaxlen_cm, sh.slunit FROM shoe_data sh, unit un WHERE (sh.slunit = un.un_name);
|
||||
shoe_ready | SELECT rsh.shoename, rsh.sh_avail, rsl.sl_name, rsl.sl_avail, int4smaller(rsh.sh_avail, rsl.sl_avail) AS total_avail FROM shoe rsh, shoelace rsl WHERE (((rsl.sl_color = rsh.slcolor) AND (rsl.sl_len_cm >= rsh.slminlen_cm)) AND (rsl.sl_len_cm <= rsh.slmaxlen_cm));
|
||||
shoelace | SELECT s.sl_name, s.sl_avail, s.sl_color, s.sl_len, s.sl_unit, (s.sl_len * u.un_fact) AS sl_len_cm FROM shoelace_data s, unit u WHERE (s.sl_unit = u.un_name);
|
||||
shoelace_candelete | SELECT shoelace_obsolete.sl_name, shoelace_obsolete.sl_avail, shoelace_obsolete.sl_color, shoelace_obsolete.sl_len, shoelace_obsolete.sl_unit, shoelace_obsolete.sl_len_cm FROM shoelace_obsolete WHERE (shoelace_obsolete.sl_avail = 0);
|
||||
shoelace_obsolete | SELECT shoelace.sl_name, shoelace.sl_avail, shoelace.sl_color, shoelace.sl_len, shoelace.sl_unit, shoelace.sl_len_cm FROM shoelace WHERE (NOT (EXISTS (SELECT shoe.shoename FROM shoe WHERE (shoe.slcolor = shoelace.sl_color))));
|
||||
street | SELECT r.name, r.thepath, c.cname FROM road r (name, thepath), real_city c (pop, cname, outline) WHERE (c.outline ## r.thepath);
|
||||
street | SELECT r.name, r.thepath, c.cname FROM road r, real_city c WHERE (c.outline ## r.thepath);
|
||||
toyemp | SELECT emp.name, emp.age, emp."location", (12 * emp.salary) AS annualsal FROM emp;
|
||||
(20 rows)
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
--
|
||||
-- Shorthand values
|
||||
-- Not directly usable for regression testing since these are not constants.
|
||||
-- So, just try to test parser and hope for the best - tgl 97/04/26
|
||||
-- So, just try to test parser and hope for the best - thomas 97/04/26
|
||||
SELECT (timestamp 'today' = (timestamp 'yesterday' + interval '1 day')) as "True";
|
||||
True
|
||||
------
|
||||
@ -34,13 +34,25 @@ SELECT (timestamp 'now' - 'current') AS "ZeroSecs";
|
||||
@ 0
|
||||
(1 row)
|
||||
|
||||
SET DateStyle = 'Postgres,noneuropean';
|
||||
SELECT timestamp('1994-01-01', '11:00') AS "Jan_01_1994_11am";
|
||||
SET DateStyle = 'Postgres,NonEuropean';
|
||||
SELECT timestamp(date '1994-01-01', time '11:00') AS "Jan_01_1994_11am";
|
||||
Jan_01_1994_11am
|
||||
------------------------------
|
||||
Sat Jan 01 11:00:00 1994 PST
|
||||
(1 row)
|
||||
|
||||
SELECT timestamp(date '1994-01-01', time '10:00') AS "Jan_01_1994_10am";
|
||||
Jan_01_1994_10am
|
||||
------------------------------
|
||||
Sat Jan 01 10:00:00 1994 PST
|
||||
(1 row)
|
||||
|
||||
SELECT timestamp(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am";
|
||||
Jan_01_1994_8am
|
||||
------------------------------
|
||||
Sat Jan 01 08:00:00 1994 PST
|
||||
(1 row)
|
||||
|
||||
CREATE TABLE TIMESTAMP_TBL ( d1 timestamp);
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('current');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('today');
|
||||
|
@ -1,8 +1,7 @@
|
||||
#!/bin/sh
|
||||
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.43 2000/03/01 21:10:04 petere Exp $
|
||||
# $Header: /cvsroot/pgsql/src/test/regress/Attic/regress.sh,v 1.44 2000/03/14 23:06:55 thomas Exp $
|
||||
#
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Syntax: $0 <hostname> [extra-tests]"
|
||||
exit 1
|
||||
fi
|
||||
@ -11,8 +10,7 @@ hostname=$1
|
||||
shift
|
||||
extratests="$*"
|
||||
|
||||
if [ "x$hostname" = "xwin" -o "x$hostname" = "xi386-pc-qnx4" ]
|
||||
then
|
||||
if [ "x$hostname" = "xwin" -o "x$hostname" = "xi386-pc-qnx4" ]; then
|
||||
HOSTLOC="-h localhost"
|
||||
else
|
||||
HOSTLOC=""
|
||||
@ -81,21 +79,22 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x$hostname" != "xi386-pc-qnx4" ]
|
||||
then
|
||||
echo "=============== installing PL/pgSQL... ================="
|
||||
if [ "x$hostname" != "xi386-pc-qnx4" ]; then
|
||||
echo "=============== installing languages... ================="
|
||||
$ECHO_N "installing PL/pgSQL .. " $ECHO_C
|
||||
createlang $HOSTLOC plpgsql regression
|
||||
if [ $? -ne 0 -a $? -ne 2 ]; then
|
||||
echo createlang failed
|
||||
echo failed
|
||||
exit 1
|
||||
else
|
||||
echo ok
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "=============== running regression queries... ================="
|
||||
echo "" > regression.diffs
|
||||
|
||||
if [ "x$hostname" = "xi386-pc-qnx4" ]
|
||||
then
|
||||
if [ "x$hostname" = "xi386-pc-qnx4" ]; then
|
||||
DIFFOPT="-b"
|
||||
else
|
||||
DIFFOPT="-w"
|
||||
@ -126,8 +125,7 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
if [ `diff ${DIFFOPT} ${EXPECTED} results/${tst}.out | wc -l` -ne 0 ]
|
||||
then
|
||||
if [ `diff ${DIFFOPT} ${EXPECTED} results/${tst}.out | wc -l` -ne 0 ]; then
|
||||
( diff ${DIFFOPT} -C3 ${EXPECTED} results/${tst}.out; \
|
||||
echo ""; \
|
||||
echo "----------------------"; \
|
||||
@ -147,24 +145,23 @@ $FRONTEND regression < errors.sql
|
||||
#set this to 1 to avoid clearing the database
|
||||
debug=0
|
||||
|
||||
if test "$debug" -eq 1
|
||||
then
|
||||
echo Skipping clearing and deletion of the regression database
|
||||
if [ test "$debug" -eq 1 ]; then
|
||||
echo Skipping clearing and deletion of the regression database
|
||||
else
|
||||
echo "=============== clearing regression database... ================="
|
||||
$FRONTEND regression < drop.sql
|
||||
if [ $? -ne 0 ]; then
|
||||
echo the drop script has an error
|
||||
exit 1
|
||||
fi
|
||||
echo "=============== clearing regression database... ================="
|
||||
$FRONTEND regression < drop.sql
|
||||
if [ $? -ne 0 ]; then
|
||||
echo the drop script has an error
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
echo "=============== dropping regression database... ================="
|
||||
dropdb regression
|
||||
if [ $? -ne 0 ]; then
|
||||
echo dropdb failed
|
||||
exit 1
|
||||
fi
|
||||
exit 0
|
||||
echo "=============== dropping regression database... ================="
|
||||
dropdb regression
|
||||
if [ $? -ne 0 ]; then
|
||||
echo dropdb failed
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
exit 0
|
||||
fi
|
||||
|
@ -189,7 +189,7 @@ DELETE FROM tmp3 where a=5;
|
||||
-- Try (and succeed)
|
||||
ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 match full;
|
||||
|
||||
DROP TABLE tmp3
|
||||
DROP TABLE tmp3;
|
||||
|
||||
DROP TABLE tmp2
|
||||
DROP TABLE tmp2;
|
||||
|
||||
|
@ -39,7 +39,7 @@ INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
|
||||
|
||||
SELECT '' AS four, BOX_TBL.*;
|
||||
|
||||
SELECT '' AS four, b.*, box_area(b.f1) as barea
|
||||
SELECT '' AS four, b.*, area(b.f1) as barea
|
||||
FROM BOX_TBL b;
|
||||
|
||||
-- overlap
|
||||
|
@ -60,7 +60,11 @@ SELECT '' AS five, f.f1, %f.f1 AS trunc_f1
|
||||
SELECT '' AS five, f.f1, f.f1 % AS round_f1
|
||||
FROM FLOAT8_TBL f;
|
||||
|
||||
SELECT sqrt(float8 '64') AS eight;
|
||||
|
||||
-- square root
|
||||
SELECT |/ float8 '64' AS eight;
|
||||
|
||||
SELECT '' AS three, f.f1, |/f.f1 AS sqrt_f1
|
||||
FROM FLOAT8_TBL f
|
||||
WHERE f.f1 > '0.0';
|
||||
@ -71,6 +75,8 @@ SELECT '' AS three, f.f1, : ( ; f.f1) AS exp_ln_f1
|
||||
WHERE f.f1 > '0.0';
|
||||
|
||||
-- cube root
|
||||
SELECT ||/ float8 '27' AS three;
|
||||
|
||||
SELECT '' AS five, f.f1, ||/f.f1 AS cbrt_f1 FROM FLOAT8_TBL f;
|
||||
|
||||
|
||||
@ -94,7 +100,7 @@ SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f;
|
||||
|
||||
SELECT '' AS five, FLOAT8_TBL.*;
|
||||
|
||||
-- test for over and under flow
|
||||
-- test for over- and underflow
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
|
||||
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
|
||||
|
@ -85,7 +85,7 @@ SELECT '' AS twenty, b.f1 / p.f1 AS rotation
|
||||
|
||||
SET geqo TO 'off';
|
||||
|
||||
SELECT '' AS eight, points(f1) AS npoints, f1 AS path FROM PATH_TBL;
|
||||
SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL;
|
||||
|
||||
SELECT '' AS four, path(f1) FROM POLYGON_TBL;
|
||||
|
||||
@ -110,7 +110,7 @@ SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 ~ p.f1 AS contains
|
||||
SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 @ poly.f1 AS contained
|
||||
FROM POLYGON_TBL poly, POINT_TBL p;
|
||||
|
||||
SELECT '' AS four, points(f1) AS npoints, f1 AS polygon
|
||||
SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon
|
||||
FROM POLYGON_TBL;
|
||||
|
||||
SELECT '' AS four, polygon(f1)
|
||||
|
@ -103,10 +103,3 @@ SELECT 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 AS ten;
|
||||
SELECT 2 + 2 / 2 AS three;
|
||||
|
||||
SELECT (2 + 2) / 2 AS two;
|
||||
|
||||
SELECT dsqrt(float8 '64') AS eight;
|
||||
|
||||
SELECT |/float8 '64' AS eight;
|
||||
|
||||
SELECT ||/float8 '27' AS three;
|
||||
|
||||
|
@ -623,10 +623,10 @@ SELECT t1.id1, t1.result, t2.expected
|
||||
AND t1.result != t2.expected;
|
||||
|
||||
-- ******************************
|
||||
-- * POWER(10, LN(value)) check
|
||||
-- * POW(10, LN(value)) check
|
||||
-- ******************************
|
||||
DELETE FROM num_result;
|
||||
INSERT INTO num_result SELECT id, 0, POWER(numeric '10', LN(ABS(round(val,200))))
|
||||
INSERT INTO num_result SELECT id, 0, POW(numeric '10', LN(ABS(round(val,200))))
|
||||
FROM num_data
|
||||
WHERE val != '0.0';
|
||||
SELECT t1.id1, t1.result, t2.expected
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
-- Shorthand values
|
||||
-- Not directly usable for regression testing since these are not constants.
|
||||
-- So, just try to test parser and hope for the best - tgl 97/04/26
|
||||
-- So, just try to test parser and hope for the best - thomas 97/04/26
|
||||
|
||||
SELECT (timestamp 'today' = (timestamp 'yesterday' + interval '1 day')) as "True";
|
||||
SELECT (timestamp 'today' = (timestamp 'tomorrow' - interval '1 day')) as "True";
|
||||
@ -12,8 +12,10 @@ SELECT (timestamp 'tomorrow' = (timestamp 'yesterday' + interval '2 days')) as "
|
||||
SELECT (timestamp 'current' = 'now') as "True";
|
||||
SELECT (timestamp 'now' - 'current') AS "ZeroSecs";
|
||||
|
||||
SET DateStyle = 'Postgres,noneuropean';
|
||||
SELECT timestamp('1994-01-01', '11:00') AS "Jan_01_1994_11am";
|
||||
SET DateStyle = 'Postgres,NonEuropean';
|
||||
SELECT timestamp(date '1994-01-01', time '11:00') AS "Jan_01_1994_11am";
|
||||
SELECT timestamp(date '1994-01-01', time '10:00') AS "Jan_01_1994_10am";
|
||||
SELECT timestamp(date '1994-01-01', time with time zone '11:00-5') AS "Jan_01_1994_8am";
|
||||
|
||||
CREATE TABLE TIMESTAMP_TBL ( d1 timestamp);
|
||||
|
||||
|
Reference in New Issue
Block a user