mirror of
https://github.com/postgres/postgres.git
synced 2025-12-07 12:02:30 +03:00
First phase of SCHEMA changes, concentrating on fixing the grammar and
the parsetree representation. As yet we don't *do* anything with schema names, just drop 'em on the floor; but you can enter schema-compatible command syntax, and there's even a primitive CREATE SCHEMA command. No doc updates yet, except to note that you can now extract a field from a function-returning-row's result with (foo(...)).fieldname.
This commit is contained in:
@@ -396,7 +396,7 @@ drop table atacc1;
|
||||
create table atacc1 ( test int );
|
||||
-- add a check constraint (fails)
|
||||
alter table atacc1 add constraint atacc_test1 check (test1>3);
|
||||
ERROR: Attribute 'test1' not found
|
||||
ERROR: Attribute "test1" not found
|
||||
drop table atacc1;
|
||||
-- something a little more complicated
|
||||
create table atacc1 ( test int, test2 int, test3 int);
|
||||
|
||||
@@ -22,19 +22,19 @@ select * from nonesuch;
|
||||
ERROR: parser: parse error at or near "select"
|
||||
-- bad name in target list
|
||||
select nonesuch from pg_database;
|
||||
ERROR: Attribute 'nonesuch' not found
|
||||
ERROR: Attribute "nonesuch" not found
|
||||
-- bad attribute name on lhs of operator
|
||||
select * from pg_database where nonesuch = pg_database.datname;
|
||||
ERROR: Attribute 'nonesuch' not found
|
||||
ERROR: Attribute "nonesuch" not found
|
||||
-- bad attribute name on rhs of operator
|
||||
select * from pg_database where pg_database.datname = nonesuch;
|
||||
ERROR: Attribute 'nonesuch' not found
|
||||
ERROR: Attribute "nonesuch" not found
|
||||
-- bad select distinct on syntax, distinct attribute missing
|
||||
select distinct on (foobar) from pg_database;
|
||||
ERROR: parser: parse error at or near "from"
|
||||
-- bad select distinct on syntax, distinct attribute not in target list
|
||||
select distinct on (foobar) * from pg_database;
|
||||
ERROR: Attribute 'foobar' not found
|
||||
ERROR: Attribute "foobar" not found
|
||||
--
|
||||
-- DELETE
|
||||
|
||||
|
||||
@@ -1177,7 +1177,7 @@ drop rule foorule;
|
||||
-- this should fail because f1 is not exposed for unqualified reference:
|
||||
create rule foorule as on insert to foo where f1 < 100
|
||||
do instead insert into foo2 values (f1);
|
||||
ERROR: Attribute 'f1' not found
|
||||
ERROR: Attribute "f1" not found
|
||||
-- this is the correct way:
|
||||
create rule foorule as on insert to foo where f1 < 100
|
||||
do instead insert into foo2 values (new.f1);
|
||||
|
||||
@@ -406,7 +406,7 @@ ORDER BY q2,q1;
|
||||
|
||||
-- This should fail, because q2 isn't a name of an EXCEPT output column
|
||||
SELECT q1 FROM int8_tbl EXCEPT SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1;
|
||||
ERROR: Attribute 'q2' not found
|
||||
ERROR: Attribute "q2" not found
|
||||
-- But this should work:
|
||||
SELECT q1 FROM int8_tbl EXCEPT (((SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1)));
|
||||
q1
|
||||
|
||||
@@ -170,44 +170,44 @@ SELECT class, aa, a FROM a_star*;
|
||||
-- joe and sally play basketball, and
|
||||
-- everyone else does nothing.
|
||||
--
|
||||
SELECT p.name, p.hobbies.name FROM ONLY person p;
|
||||
SELECT p.name, name(p.hobbies) FROM ONLY person p;
|
||||
|
||||
--
|
||||
-- as above, but jeff also does post_hacking.
|
||||
--
|
||||
SELECT p.name, p.hobbies.name FROM person* p;
|
||||
SELECT p.name, name(p.hobbies) FROM person* p;
|
||||
|
||||
--
|
||||
-- the next two queries demonstrate how functions generate bogus duplicates.
|
||||
-- this is a "feature" ..
|
||||
--
|
||||
SELECT DISTINCT hobbies_r.name, hobbies_r.equipment.name FROM hobbies_r;
|
||||
SELECT DISTINCT hobbies_r.name, name(hobbies_r.equipment) FROM hobbies_r;
|
||||
|
||||
SELECT hobbies_r.name, hobbies_r.equipment.name FROM hobbies_r;
|
||||
SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r;
|
||||
|
||||
--
|
||||
-- mike needs advil and peet's coffee,
|
||||
-- joe and sally need hightops, and
|
||||
-- everyone else is fine.
|
||||
--
|
||||
SELECT p.name, p.hobbies.name, p.hobbies.equipment.name FROM ONLY person p;
|
||||
SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p;
|
||||
|
||||
--
|
||||
-- as above, but jeff needs advil and peet's coffee as well.
|
||||
--
|
||||
SELECT p.name, p.hobbies.name, p.hobbies.equipment.name FROM person* p;
|
||||
SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p;
|
||||
|
||||
--
|
||||
-- just like the last two, but make sure that the target list fixup and
|
||||
-- unflattening is being done correctly.
|
||||
--
|
||||
SELECT p.hobbies.equipment.name, p.name, p.hobbies.name FROM ONLY person p;
|
||||
SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p;
|
||||
|
||||
SELECT p.hobbies.equipment.name, p.name, p.hobbies.name FROM person* p;
|
||||
SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p;
|
||||
|
||||
SELECT p.hobbies.equipment.name, p.hobbies.name, p.name FROM ONLY person p;
|
||||
SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p;
|
||||
|
||||
SELECT p.hobbies.equipment.name, p.hobbies.name, p.name FROM person* p;
|
||||
SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p;
|
||||
|
||||
SELECT user_relns() AS user_relns
|
||||
ORDER BY user_relns;
|
||||
|
||||
@@ -442,7 +442,7 @@ SELECT class, aa, a FROM a_star*;
|
||||
-- joe and sally play basketball, and
|
||||
-- everyone else does nothing.
|
||||
--
|
||||
SELECT p.name, p.hobbies.name FROM ONLY person p;
|
||||
SELECT p.name, name(p.hobbies) FROM ONLY person p;
|
||||
name | name
|
||||
-------+-------------
|
||||
mike | posthacking
|
||||
@@ -453,7 +453,7 @@ SELECT p.name, p.hobbies.name FROM ONLY person p;
|
||||
--
|
||||
-- as above, but jeff also does post_hacking.
|
||||
--
|
||||
SELECT p.name, p.hobbies.name FROM person* p;
|
||||
SELECT p.name, name(p.hobbies) FROM person* p;
|
||||
name | name
|
||||
-------+-------------
|
||||
mike | posthacking
|
||||
@@ -466,7 +466,7 @@ SELECT p.name, p.hobbies.name FROM person* p;
|
||||
-- the next two queries demonstrate how functions generate bogus duplicates.
|
||||
-- this is a "feature" ..
|
||||
--
|
||||
SELECT DISTINCT hobbies_r.name, hobbies_r.equipment.name FROM hobbies_r;
|
||||
SELECT DISTINCT hobbies_r.name, name(hobbies_r.equipment) FROM hobbies_r;
|
||||
name | name
|
||||
-------------+---------------
|
||||
basketball | hightops
|
||||
@@ -475,7 +475,7 @@ SELECT DISTINCT hobbies_r.name, hobbies_r.equipment.name FROM hobbies_r;
|
||||
skywalking | guts
|
||||
(4 rows)
|
||||
|
||||
SELECT hobbies_r.name, hobbies_r.equipment.name FROM hobbies_r;
|
||||
SELECT hobbies_r.name, (hobbies_r.equipment).name FROM hobbies_r;
|
||||
name | name
|
||||
-------------+---------------
|
||||
posthacking | advil
|
||||
@@ -492,7 +492,7 @@ SELECT hobbies_r.name, hobbies_r.equipment.name FROM hobbies_r;
|
||||
-- joe and sally need hightops, and
|
||||
-- everyone else is fine.
|
||||
--
|
||||
SELECT p.name, p.hobbies.name, p.hobbies.equipment.name FROM ONLY person p;
|
||||
SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM ONLY person p;
|
||||
name | name | name
|
||||
-------+-------------+---------------
|
||||
mike | posthacking | advil
|
||||
@@ -504,7 +504,7 @@ SELECT p.name, p.hobbies.name, p.hobbies.equipment.name FROM ONLY person p;
|
||||
--
|
||||
-- as above, but jeff needs advil and peet's coffee as well.
|
||||
--
|
||||
SELECT p.name, p.hobbies.name, p.hobbies.equipment.name FROM person* p;
|
||||
SELECT p.name, name(p.hobbies), name(equipment(p.hobbies)) FROM person* p;
|
||||
name | name | name
|
||||
-------+-------------+---------------
|
||||
mike | posthacking | advil
|
||||
@@ -519,7 +519,7 @@ SELECT p.name, p.hobbies.name, p.hobbies.equipment.name FROM person* p;
|
||||
-- just like the last two, but make sure that the target list fixup and
|
||||
-- unflattening is being done correctly.
|
||||
--
|
||||
SELECT p.hobbies.equipment.name, p.name, p.hobbies.name FROM ONLY person p;
|
||||
SELECT name(equipment(p.hobbies)), p.name, name(p.hobbies) FROM ONLY person p;
|
||||
name | name | name
|
||||
---------------+-------+-------------
|
||||
advil | mike | posthacking
|
||||
@@ -528,7 +528,7 @@ SELECT p.hobbies.equipment.name, p.name, p.hobbies.name FROM ONLY person p;
|
||||
hightops | sally | basketball
|
||||
(4 rows)
|
||||
|
||||
SELECT p.hobbies.equipment.name, p.name, p.hobbies.name FROM person* p;
|
||||
SELECT (p.hobbies).equipment.name, p.name, name(p.hobbies) FROM person* p;
|
||||
name | name | name
|
||||
---------------+-------+-------------
|
||||
advil | mike | posthacking
|
||||
@@ -539,7 +539,7 @@ SELECT p.hobbies.equipment.name, p.name, p.hobbies.name FROM person* p;
|
||||
peet's coffee | jeff | posthacking
|
||||
(6 rows)
|
||||
|
||||
SELECT p.hobbies.equipment.name, p.hobbies.name, p.name FROM ONLY person p;
|
||||
SELECT (p.hobbies).equipment.name, name(p.hobbies), p.name FROM ONLY person p;
|
||||
name | name | name
|
||||
---------------+-------------+-------
|
||||
advil | posthacking | mike
|
||||
@@ -548,7 +548,7 @@ SELECT p.hobbies.equipment.name, p.hobbies.name, p.name FROM ONLY person p;
|
||||
hightops | basketball | sally
|
||||
(4 rows)
|
||||
|
||||
SELECT p.hobbies.equipment.name, p.hobbies.name, p.name FROM person* p;
|
||||
SELECT name(equipment(p.hobbies)), name(p.hobbies), p.name FROM person* p;
|
||||
name | name | name
|
||||
---------------+-------------+-------
|
||||
advil | posthacking | mike
|
||||
|
||||
Reference in New Issue
Block a user