mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
Another round of error message editing, covering backend/parser/.
This commit is contained in:
@@ -156,4 +156,4 @@ select ten, sum(distinct four) from onek a
|
||||
group by ten
|
||||
having exists (select 1 from onek b
|
||||
where sum(distinct a.four + b.four) = b.four);
|
||||
ERROR: Aggregates not allowed in WHERE clause
|
||||
ERROR: aggregates not allowed in WHERE clause
|
||||
|
||||
@@ -291,10 +291,10 @@ alter table stud_emp rename to pg_toast_stud_emp;
|
||||
alter table pg_toast_stud_emp rename to stud_emp;
|
||||
-- FOREIGN KEY CONSTRAINT adding TEST
|
||||
CREATE TABLE tmp2 (a int primary key);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'tmp2_pkey' for table 'tmp2'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "tmp2_pkey" for table "tmp2"
|
||||
CREATE TABLE tmp3 (a int, b int);
|
||||
CREATE TABLE tmp4 (a int, b int, unique(a,b));
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'tmp4_a_key' for table 'tmp4'
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index "tmp4_a_key" for table "tmp4"
|
||||
CREATE TABLE tmp5 (a int, b int);
|
||||
-- Insert rows into tmp2 (pktable)
|
||||
INSERT INTO tmp2 values (1);
|
||||
@@ -335,7 +335,7 @@ DROP TABLE tmp2;
|
||||
-- Note: these tables are TEMP to avoid name conflicts when this test
|
||||
-- is run in parallel with foreign_key.sql.
|
||||
CREATE TEMP TABLE PKTABLE (ptest1 int PRIMARY KEY);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TEMP TABLE FKTABLE (ftest1 inet);
|
||||
-- This next should fail, because inet=int does not exist
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
|
||||
@@ -363,7 +363,7 @@ NOTICE: Drop cascades to constraint $1 on table fktable
|
||||
DROP TABLE fktable;
|
||||
CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 inet,
|
||||
PRIMARY KEY(ptest1, ptest2));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
-- This should fail, because we just chose really odd types
|
||||
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp);
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable;
|
||||
@@ -416,7 +416,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);
|
||||
@@ -470,7 +470,7 @@ drop table atacc1;
|
||||
create table atacc1 ( test int );
|
||||
-- add a unique constraint
|
||||
alter table atacc1 add constraint atacc_test1 unique (test);
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_test1" for table "atacc1"
|
||||
-- insert first value
|
||||
insert into atacc1 (test) values (2);
|
||||
-- should fail
|
||||
@@ -480,7 +480,7 @@ ERROR: Cannot insert a duplicate key into unique index atacc_test1
|
||||
insert into atacc1 (test) values (4);
|
||||
-- try adding a unique oid constraint
|
||||
alter table atacc1 add constraint atacc_oid1 unique(oid);
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc_oid1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_oid1" for table "atacc1"
|
||||
drop table atacc1;
|
||||
-- let's do one where the unique constraint fails when added
|
||||
create table atacc1 ( test int );
|
||||
@@ -489,7 +489,7 @@ insert into atacc1 (test) values (2);
|
||||
insert into atacc1 (test) values (2);
|
||||
-- add a unique constraint (fails)
|
||||
alter table atacc1 add constraint atacc_test1 unique (test);
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_test1" for table "atacc1"
|
||||
ERROR: Cannot create unique index. Table contains non-unique values
|
||||
insert into atacc1 (test) values (3);
|
||||
drop table atacc1;
|
||||
@@ -498,13 +498,13 @@ drop table atacc1;
|
||||
create table atacc1 ( test int );
|
||||
-- add a unique constraint (fails)
|
||||
alter table atacc1 add constraint atacc_test1 unique (test1);
|
||||
ERROR: ALTER TABLE: column "test1" named in key does not exist
|
||||
ERROR: column "test1" named in key does not exist
|
||||
drop table atacc1;
|
||||
-- something a little more complicated
|
||||
create table atacc1 ( test int, test2 int);
|
||||
-- add a unique constraint
|
||||
alter table atacc1 add constraint atacc_test1 unique (test, test2);
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc_test1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_test1" for table "atacc1"
|
||||
-- insert initial value
|
||||
insert into atacc1 (test,test2) values (4,4);
|
||||
-- should fail
|
||||
@@ -517,9 +517,9 @@ insert into atacc1 (test,test2) values (5,5);
|
||||
drop table atacc1;
|
||||
-- lets do some naming tests
|
||||
create table atacc1 (test int, test2 int, unique(test));
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'atacc1_test_key' for table 'atacc1'
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index "atacc1_test_key" for table "atacc1"
|
||||
alter table atacc1 add unique (test2);
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index 'atacc1_test2_key' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc1_test2_key" for table "atacc1"
|
||||
-- should fail for @@ second one @@
|
||||
insert into atacc1 (test2, test) values (3, 3);
|
||||
insert into atacc1 (test2, test) values (2, 3);
|
||||
@@ -529,7 +529,7 @@ drop table atacc1;
|
||||
create table atacc1 ( test int );
|
||||
-- add a primary key constraint
|
||||
alter table atacc1 add constraint atacc_test1 primary key (test);
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index 'atacc_test1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc_test1" for table "atacc1"
|
||||
-- insert first value
|
||||
insert into atacc1 (test) values (2);
|
||||
-- should fail
|
||||
@@ -542,12 +542,12 @@ insert into atacc1 (test) values(NULL);
|
||||
ERROR: ExecInsert: Fail to add null value in not null attribute test
|
||||
-- try adding a second primary key (should fail)
|
||||
alter table atacc1 add constraint atacc_oid1 primary key(oid);
|
||||
ERROR: ALTER TABLE / PRIMARY KEY multiple primary keys for table 'atacc1' are not allowed
|
||||
ERROR: multiple primary keys for table "atacc1" are not allowed
|
||||
-- drop first primary key constraint
|
||||
alter table atacc1 drop constraint atacc_test1 restrict;
|
||||
-- try adding a primary key on oid (should succeed)
|
||||
alter table atacc1 add constraint atacc_oid1 primary key(oid);
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index 'atacc_oid1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc_oid1" for table "atacc1"
|
||||
drop table atacc1;
|
||||
-- let's do one where the primary key constraint fails when added
|
||||
create table atacc1 ( test int );
|
||||
@@ -556,7 +556,7 @@ insert into atacc1 (test) values (2);
|
||||
insert into atacc1 (test) values (2);
|
||||
-- add a primary key (fails)
|
||||
alter table atacc1 add constraint atacc_test1 primary key (test);
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index 'atacc_test1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc_test1" for table "atacc1"
|
||||
ERROR: Cannot create unique index. Table contains non-unique values
|
||||
insert into atacc1 (test) values (3);
|
||||
drop table atacc1;
|
||||
@@ -566,7 +566,7 @@ create table atacc1 ( test int );
|
||||
insert into atacc1 (test) values (NULL);
|
||||
-- add a primary key (fails)
|
||||
alter table atacc1 add constraint atacc_test1 primary key (test);
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index 'atacc_test1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc_test1" for table "atacc1"
|
||||
ERROR: ALTER TABLE: Attribute "test" contains NULL values
|
||||
insert into atacc1 (test) values (3);
|
||||
drop table atacc1;
|
||||
@@ -575,16 +575,16 @@ drop table atacc1;
|
||||
create table atacc1 ( test int );
|
||||
-- add a primary key constraint (fails)
|
||||
alter table atacc1 add constraint atacc_test1 primary key (test1);
|
||||
ERROR: ALTER TABLE: column "test1" named in key does not exist
|
||||
ERROR: column "test1" named in key does not exist
|
||||
drop table atacc1;
|
||||
-- something a little more complicated
|
||||
create table atacc1 ( test int, test2 int);
|
||||
-- add a primary key constraint
|
||||
alter table atacc1 add constraint atacc_test1 primary key (test, test2);
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index 'atacc_test1' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc_test1" for table "atacc1"
|
||||
-- try adding a second primary key - should fail
|
||||
alter table atacc1 add constraint atacc_test2 primary key (test);
|
||||
ERROR: ALTER TABLE / PRIMARY KEY multiple primary keys for table 'atacc1' are not allowed
|
||||
ERROR: multiple primary keys for table "atacc1" are not allowed
|
||||
-- insert initial value
|
||||
insert into atacc1 (test,test2) values (4,4);
|
||||
-- should fail
|
||||
@@ -603,7 +603,7 @@ insert into atacc1 (test,test2) values (5,5);
|
||||
drop table atacc1;
|
||||
-- lets do some naming tests
|
||||
create table atacc1 (test int, test2 int, primary key(test));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'atacc1_pkey' for table 'atacc1'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "atacc1_pkey" for table "atacc1"
|
||||
-- only first should succeed
|
||||
insert into atacc1 (test2, test) values (3, 3);
|
||||
insert into atacc1 (test2, test) values (2, 3);
|
||||
@@ -626,7 +626,7 @@ ERROR: Relation "non_existent" does not exist
|
||||
-- test checking for null values and primary key
|
||||
create table atacc1 (test int not null);
|
||||
alter table atacc1 add constraint "atacc1_pkey" primary key (test);
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index 'atacc1_pkey' for table 'atacc1'
|
||||
NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc1_pkey" for table "atacc1"
|
||||
alter table atacc1 alter column test drop not null;
|
||||
ERROR: ALTER TABLE: Attribute "test" is in a primary key
|
||||
alter table atacc1 drop constraint "atacc1_pkey";
|
||||
@@ -759,13 +759,13 @@ select * from atacc1;
|
||||
(1 row)
|
||||
|
||||
select * from atacc1 order by a;
|
||||
ERROR: Attribute "a" not found
|
||||
ERROR: attribute "a" not found
|
||||
select * from atacc1 order by "........pg.dropped.1........";
|
||||
ERROR: Attribute "........pg.dropped.1........" not found
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
select * from atacc1 group by a;
|
||||
ERROR: Attribute "a" not found
|
||||
ERROR: attribute "a" not found
|
||||
select * from atacc1 group by "........pg.dropped.1........";
|
||||
ERROR: Attribute "........pg.dropped.1........" not found
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
select atacc1.* from atacc1;
|
||||
b | c | d
|
||||
---+---+---
|
||||
@@ -773,7 +773,7 @@ select atacc1.* from atacc1;
|
||||
(1 row)
|
||||
|
||||
select a from atacc1;
|
||||
ERROR: Attribute "a" not found
|
||||
ERROR: attribute "a" not found
|
||||
select atacc1.a from atacc1;
|
||||
ERROR: no such attribute atacc1.a
|
||||
select b,c,d from atacc1;
|
||||
@@ -783,26 +783,26 @@ select b,c,d from atacc1;
|
||||
(1 row)
|
||||
|
||||
select a,b,c,d from atacc1;
|
||||
ERROR: Attribute "a" not found
|
||||
ERROR: attribute "a" not found
|
||||
select * from atacc1 where a = 1;
|
||||
ERROR: Attribute "a" not found
|
||||
ERROR: attribute "a" not found
|
||||
select "........pg.dropped.1........" from atacc1;
|
||||
ERROR: Attribute "........pg.dropped.1........" not found
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
select atacc1."........pg.dropped.1........" from atacc1;
|
||||
ERROR: no such attribute atacc1.........pg.dropped.1........
|
||||
select "........pg.dropped.1........",b,c,d from atacc1;
|
||||
ERROR: Attribute "........pg.dropped.1........" not found
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
select * from atacc1 where "........pg.dropped.1........" = 1;
|
||||
ERROR: Attribute "........pg.dropped.1........" not found
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
-- UPDATEs
|
||||
update atacc1 set a = 3;
|
||||
ERROR: Relation "atacc1" has no column "a"
|
||||
ERROR: relation "atacc1" has no column "a"
|
||||
update atacc1 set b = 2 where a = 3;
|
||||
ERROR: Attribute "a" not found
|
||||
ERROR: attribute "a" not found
|
||||
update atacc1 set "........pg.dropped.1........" = 3;
|
||||
ERROR: Relation "atacc1" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "atacc1" has no column "........pg.dropped.1........"
|
||||
update atacc1 set b = 2 where "........pg.dropped.1........" = 3;
|
||||
ERROR: Attribute "........pg.dropped.1........" not found
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
-- INSERTs
|
||||
insert into atacc1 values (10, 11, 12, 13);
|
||||
ERROR: INSERT has more expressions than target columns
|
||||
@@ -810,27 +810,27 @@ insert into atacc1 values (default, 11, 12, 13);
|
||||
ERROR: INSERT has more expressions than target columns
|
||||
insert into atacc1 values (11, 12, 13);
|
||||
insert into atacc1 (a) values (10);
|
||||
ERROR: Relation "atacc1" has no column "a"
|
||||
ERROR: relation "atacc1" has no column "a"
|
||||
insert into atacc1 (a) values (default);
|
||||
ERROR: Relation "atacc1" has no column "a"
|
||||
ERROR: relation "atacc1" has no column "a"
|
||||
insert into atacc1 (a,b,c,d) values (10,11,12,13);
|
||||
ERROR: Relation "atacc1" has no column "a"
|
||||
ERROR: relation "atacc1" has no column "a"
|
||||
insert into atacc1 (a,b,c,d) values (default,11,12,13);
|
||||
ERROR: Relation "atacc1" has no column "a"
|
||||
ERROR: relation "atacc1" has no column "a"
|
||||
insert into atacc1 (b,c,d) values (11,12,13);
|
||||
insert into atacc1 ("........pg.dropped.1........") values (10);
|
||||
ERROR: Relation "atacc1" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "atacc1" has no column "........pg.dropped.1........"
|
||||
insert into atacc1 ("........pg.dropped.1........") values (default);
|
||||
ERROR: Relation "atacc1" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "atacc1" has no column "........pg.dropped.1........"
|
||||
insert into atacc1 ("........pg.dropped.1........",b,c,d) values (10,11,12,13);
|
||||
ERROR: Relation "atacc1" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "atacc1" has no column "........pg.dropped.1........"
|
||||
insert into atacc1 ("........pg.dropped.1........",b,c,d) values (default,11,12,13);
|
||||
ERROR: Relation "atacc1" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "atacc1" has no column "........pg.dropped.1........"
|
||||
-- DELETEs
|
||||
delete from atacc1 where a = 3;
|
||||
ERROR: Attribute "a" not found
|
||||
ERROR: attribute "a" not found
|
||||
delete from atacc1 where "........pg.dropped.1........" = 3;
|
||||
ERROR: Attribute "........pg.dropped.1........" not found
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
delete from atacc1;
|
||||
-- try dropping a non-existent column, should fail
|
||||
alter table atacc1 drop bar;
|
||||
@@ -850,13 +850,13 @@ ERROR: ALTER TABLE: relation "myview" is not a table
|
||||
drop view myview;
|
||||
-- test some commands to make sure they fail on the dropped column
|
||||
analyze atacc1(a);
|
||||
ERROR: Relation "atacc1" has no column "a"
|
||||
ERROR: relation "atacc1" has no column "a"
|
||||
analyze atacc1("........pg.dropped.1........");
|
||||
ERROR: Relation "atacc1" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "atacc1" has no column "........pg.dropped.1........"
|
||||
vacuum analyze atacc1(a);
|
||||
ERROR: Relation "atacc1" has no column "a"
|
||||
ERROR: relation "atacc1" has no column "a"
|
||||
vacuum analyze atacc1("........pg.dropped.1........");
|
||||
ERROR: Relation "atacc1" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "atacc1" has no column "........pg.dropped.1........"
|
||||
comment on column atacc1.a is 'testing';
|
||||
ERROR: Relation "atacc1" has no column "a"
|
||||
comment on column atacc1."........pg.dropped.1........" is 'testing';
|
||||
@@ -890,19 +890,19 @@ ERROR: renameatt: attribute "a" does not exist
|
||||
alter table atacc1 rename "........pg.dropped.1........" to x;
|
||||
ERROR: renameatt: attribute "........pg.dropped.1........" does not exist
|
||||
alter table atacc1 add primary key(a);
|
||||
ERROR: ALTER TABLE: column "a" named in key does not exist
|
||||
ERROR: column "a" named in key does not exist
|
||||
alter table atacc1 add primary key("........pg.dropped.1........");
|
||||
ERROR: ALTER TABLE: column "........pg.dropped.1........" named in key does not exist
|
||||
ERROR: column "........pg.dropped.1........" named in key does not exist
|
||||
alter table atacc1 add unique(a);
|
||||
ERROR: ALTER TABLE: column "a" named in key does not exist
|
||||
ERROR: column "a" named in key does not exist
|
||||
alter table atacc1 add unique("........pg.dropped.1........");
|
||||
ERROR: ALTER TABLE: column "........pg.dropped.1........" named in key does not exist
|
||||
ERROR: column "........pg.dropped.1........" named in key does not exist
|
||||
alter table atacc1 add check (a > 3);
|
||||
ERROR: Attribute "a" not found
|
||||
ERROR: attribute "a" not found
|
||||
alter table atacc1 add check ("........pg.dropped.1........" > 3);
|
||||
ERROR: Attribute "........pg.dropped.1........" not found
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
create table atacc2 (id int4 unique);
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'atacc2_id_key' for table 'atacc2'
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index "atacc2_id_key" for table "atacc2"
|
||||
alter table atacc1 add foreign key (a) references atacc2(id);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: ALTER TABLE: column "a" referenced in foreign key constraint does not exist
|
||||
@@ -990,9 +990,9 @@ alter table test drop a;
|
||||
copy test to stdout;
|
||||
2 3
|
||||
copy test(a) to stdout;
|
||||
ERROR: Relation "test" has no column "a"
|
||||
ERROR: relation "test" has no column "a"
|
||||
copy test("........pg.dropped.1........") to stdout;
|
||||
ERROR: Relation "test" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "test" has no column "........pg.dropped.1........"
|
||||
copy test from stdin;
|
||||
ERROR: Extra data after last expected column
|
||||
CONTEXT: COPY FROM, line 1
|
||||
@@ -1011,9 +1011,9 @@ select * from test;
|
||||
(2 rows)
|
||||
|
||||
copy test(a) from stdin;
|
||||
ERROR: Relation "test" has no column "a"
|
||||
ERROR: relation "test" has no column "a"
|
||||
copy test("........pg.dropped.1........") from stdin;
|
||||
ERROR: Relation "test" has no column "........pg.dropped.1........"
|
||||
ERROR: relation "test" has no column "........pg.dropped.1........"
|
||||
copy test(b,c) from stdin;
|
||||
select * from test;
|
||||
b | c
|
||||
@@ -1072,7 +1072,7 @@ select f1 from c1;
|
||||
|
||||
alter table c1 drop column f1;
|
||||
select f1 from c1;
|
||||
ERROR: Attribute "f1" not found
|
||||
ERROR: attribute "f1" not found
|
||||
drop table p1 cascade;
|
||||
NOTICE: Drop cascades to table c1
|
||||
create table p1 (f1 int, f2 int);
|
||||
@@ -1083,7 +1083,7 @@ ERROR: ALTER TABLE: Cannot drop inherited column "f1"
|
||||
alter table p1 drop column f1;
|
||||
-- c1.f1 is dropped now, since there is no local definition for it
|
||||
select f1 from c1;
|
||||
ERROR: Attribute "f1" not found
|
||||
ERROR: attribute "f1" not found
|
||||
drop table p1 cascade;
|
||||
NOTICE: Drop cascades to table c1
|
||||
create table p1 (f1 int, f2 int);
|
||||
@@ -1181,7 +1181,7 @@ select oid > 0, * from altstartwith;
|
||||
|
||||
alter table altstartwith set without oids;
|
||||
select oid > 0, * from altstartwith; -- fails
|
||||
ERROR: Attribute "oid" not found
|
||||
ERROR: attribute "oid" not found
|
||||
select * from altstartwith;
|
||||
col
|
||||
-----
|
||||
@@ -1209,9 +1209,9 @@ alter table altwithoid set without oids;
|
||||
alter table altinhoid set without oids; -- fails
|
||||
ERROR: ALTER TABLE: Table is already WITHOUT OIDS
|
||||
select oid > 0, * from altwithoid; -- fails
|
||||
ERROR: Attribute "oid" not found
|
||||
ERROR: attribute "oid" not found
|
||||
select oid > 0, * from altinhoid; -- fails
|
||||
ERROR: Attribute "oid" not found
|
||||
ERROR: attribute "oid" not found
|
||||
select * from altwithoid;
|
||||
col
|
||||
-----
|
||||
|
||||
@@ -358,7 +358,7 @@ select 33 * any (44);
|
||||
ERROR: op ANY/ALL (array) requires array on right side
|
||||
-- test indexes on arrays
|
||||
create temp table arr_tbl (f1 int[] unique);
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'arr_tbl_f1_key' for table 'arr_tbl'
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index "arr_tbl_f1_key" for table "arr_tbl"
|
||||
insert into arr_tbl values ('{1,2,3}');
|
||||
insert into arr_tbl values ('{1,2}');
|
||||
-- failure expected:
|
||||
|
||||
@@ -3,15 +3,15 @@
|
||||
--
|
||||
CREATE TABLE clstr_tst_s (rf_a SERIAL PRIMARY KEY,
|
||||
b INT);
|
||||
NOTICE: CREATE TABLE will create implicit sequence 'clstr_tst_s_rf_a_seq' for SERIAL column 'clstr_tst_s.rf_a'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_tst_s_pkey' for table 'clstr_tst_s'
|
||||
NOTICE: CREATE TABLE will create implicit sequence "clstr_tst_s_rf_a_seq" for SERIAL column "clstr_tst_s.rf_a"
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_tst_s_pkey" for table "clstr_tst_s"
|
||||
CREATE TABLE clstr_tst (a SERIAL PRIMARY KEY,
|
||||
b INT,
|
||||
c TEXT,
|
||||
d TEXT,
|
||||
CONSTRAINT clstr_tst_con FOREIGN KEY (b) REFERENCES clstr_tst_s);
|
||||
NOTICE: CREATE TABLE will create implicit sequence 'clstr_tst_a_seq' for SERIAL column 'clstr_tst.a'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_tst_pkey' for table 'clstr_tst'
|
||||
NOTICE: CREATE TABLE will create implicit sequence "clstr_tst_a_seq" for SERIAL column "clstr_tst.a"
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_tst_pkey" for table "clstr_tst"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
CREATE INDEX clstr_tst_b ON clstr_tst (b);
|
||||
CREATE INDEX clstr_tst_c ON clstr_tst (c);
|
||||
@@ -300,11 +300,11 @@ WHERE pg_class.oid=indexrelid
|
||||
-- Verify that clustering all tables does in fact cluster the right ones
|
||||
CREATE USER clstr_user;
|
||||
CREATE TABLE clstr_1 (a INT PRIMARY KEY);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_1_pkey' for table 'clstr_1'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_1_pkey" for table "clstr_1"
|
||||
CREATE TABLE clstr_2 (a INT PRIMARY KEY);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_2_pkey' for table 'clstr_2'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_2_pkey" for table "clstr_2"
|
||||
CREATE TABLE clstr_3 (a INT PRIMARY KEY);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'clstr_3_pkey' for table 'clstr_3'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "clstr_3_pkey" for table "clstr_3"
|
||||
ALTER TABLE clstr_1 OWNER TO clstr_user;
|
||||
ALTER TABLE clstr_3 OWNER TO clstr_user;
|
||||
GRANT SELECT ON clstr_2 TO clstr_user;
|
||||
|
||||
@@ -5,7 +5,7 @@ CREATE TABLE x (
|
||||
d text not null,
|
||||
e text
|
||||
);
|
||||
NOTICE: CREATE TABLE will create implicit sequence 'x_a_seq' for SERIAL column 'x.a'
|
||||
NOTICE: CREATE TABLE will create implicit sequence "x_a_seq" for SERIAL column "x.a"
|
||||
CREATE FUNCTION fn_x_before () RETURNS TRIGGER AS '
|
||||
BEGIN
|
||||
NEW.e := ''before trigger fired''::text;
|
||||
@@ -28,7 +28,7 @@ COPY x (b, d) from stdin;
|
||||
COPY x (a, b, c, d, e) from stdin;
|
||||
-- non-existent column in column list: should fail
|
||||
COPY x (xyz) from stdin;
|
||||
ERROR: Relation "x" has no column "xyz"
|
||||
ERROR: relation "x" has no column "xyz"
|
||||
-- too many columns in column list: should fail
|
||||
COPY x (a, b, c, d, e, d, c) from stdin;
|
||||
ERROR: Attribute "d" specified more than once
|
||||
|
||||
@@ -174,7 +174,7 @@ create table defaulttest
|
||||
, col7 ddef4 DEFAULT 8000
|
||||
, col8 ddef5
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'defaulttest_pkey' for table 'defaulttest'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "defaulttest_pkey" for table "defaulttest"
|
||||
insert into defaulttest default values;
|
||||
insert into defaulttest default values;
|
||||
insert into defaulttest default values;
|
||||
|
||||
@@ -31,19 +31,19 @@ select from pg_database;
|
||||
ERROR: syntax error at or near "from" at character 8
|
||||
-- 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: syntax error at or near "from" at character 29
|
||||
-- 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
|
||||
|
||||
@@ -143,7 +143,7 @@ drop aggregate 314159 (int);
|
||||
ERROR: syntax error at or near "314159" at character 16
|
||||
-- bad aggregate type
|
||||
drop aggregate newcnt (nonesuch);
|
||||
ERROR: Type "nonesuch" does not exist
|
||||
ERROR: type "nonesuch" does not exist
|
||||
-- no such aggregate
|
||||
drop aggregate nonesuch (int4);
|
||||
ERROR: aggregate nonesuch(integer) does not exist
|
||||
@@ -197,13 +197,13 @@ drop operator === ();
|
||||
ERROR: syntax error at or near ")" at character 20
|
||||
-- no such operator
|
||||
drop operator === (int4);
|
||||
ERROR: parser: argument type missing (use NONE for unary operators)
|
||||
ERROR: argument type missing (use NONE for unary operators)
|
||||
-- no such operator by that name
|
||||
drop operator === (int4, int4);
|
||||
ERROR: operator does not exist: integer === integer
|
||||
-- no such type1
|
||||
drop operator = (nonesuch);
|
||||
ERROR: parser: argument type missing (use NONE for unary operators)
|
||||
ERROR: argument type missing (use NONE for unary operators)
|
||||
-- no such type1
|
||||
drop operator = ( , int4);
|
||||
ERROR: syntax error at or near "," at character 19
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
-- First test, check and cascade
|
||||
--
|
||||
CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text );
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE ( ftest1 int REFERENCES PKTABLE MATCH FULL ON DELETE CASCADE ON UPDATE CASCADE, ftest2 int );
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
-- Insert test data into PKTABLE
|
||||
@@ -61,7 +61,7 @@ DROP TABLE PKTABLE;
|
||||
-- check set NULL and table constraint on multiple columns
|
||||
--
|
||||
CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1, ptest2) );
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, CONSTRAINT constrname FOREIGN KEY(ftest1, ftest2)
|
||||
REFERENCES PKTABLE MATCH FULL ON DELETE SET NULL ON UPDATE SET NULL);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
@@ -144,7 +144,7 @@ DROP TABLE FKTABLE;
|
||||
-- check set default and table constraint on multiple columns
|
||||
--
|
||||
CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1, ptest2) );
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE ( ftest1 int DEFAULT -1, ftest2 int DEFAULT -2, ftest3 int, CONSTRAINT constrname2 FOREIGN KEY(ftest1, ftest2)
|
||||
REFERENCES PKTABLE MATCH FULL ON DELETE SET DEFAULT ON UPDATE SET DEFAULT);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
@@ -234,7 +234,7 @@ DROP TABLE FKTABLE;
|
||||
-- First test, check with no on delete or on update
|
||||
--
|
||||
CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text );
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE ( ftest1 int REFERENCES PKTABLE MATCH FULL, ftest2 int );
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
-- Insert test data into PKTABLE
|
||||
@@ -307,7 +307,7 @@ DROP TABLE PKTABLE;
|
||||
-- MATCH unspecified
|
||||
-- Base test restricting update/delete
|
||||
CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) );
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3
|
||||
FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
@@ -369,7 +369,7 @@ DROP TABLE FKTABLE;
|
||||
DROP TABLE PKTABLE;
|
||||
-- cascade update/delete
|
||||
CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) );
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE ( ftest1 int, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3
|
||||
FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE
|
||||
ON DELETE CASCADE ON UPDATE CASCADE);
|
||||
@@ -466,7 +466,7 @@ DROP TABLE FKTABLE;
|
||||
DROP TABLE PKTABLE;
|
||||
-- set null update / set default delete
|
||||
CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) );
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE ( ftest1 int DEFAULT 0, ftest2 int, ftest3 int, ftest4 int, CONSTRAINT constrname3
|
||||
FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE
|
||||
ON DELETE SET DEFAULT ON UPDATE SET NULL);
|
||||
@@ -570,7 +570,7 @@ DROP TABLE FKTABLE;
|
||||
DROP TABLE PKTABLE;
|
||||
-- set default update / set null delete
|
||||
CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY KEY(ptest1, ptest2, ptest3) );
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE ( ftest1 int DEFAULT 0, ftest2 int DEFAULT -1, ftest3 int, ftest4 int, CONSTRAINT constrname3
|
||||
FOREIGN KEY(ftest1, ftest2, ftest3) REFERENCES PKTABLE
|
||||
ON DELETE SET NULL ON UPDATE SET DEFAULT);
|
||||
@@ -686,7 +686,7 @@ SELECT * from FKTABLE;
|
||||
DROP TABLE FKTABLE;
|
||||
DROP TABLE PKTABLE;
|
||||
CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE FKTABLE_FAIL1 ( ftest1 int, CONSTRAINT fkfail1 FOREIGN KEY (ftest2) REFERENCES PKTABLE);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: CREATE TABLE: column "ftest2" referenced in foreign key constraint does not exist
|
||||
@@ -700,7 +700,7 @@ ERROR: table "fktable_fail2" does not exist
|
||||
DROP TABLE PKTABLE;
|
||||
-- Test for referencing column number smaller than referenced constraint
|
||||
CREATE TABLE PKTABLE (ptest1 int, ptest2 int, UNIQUE(ptest1, ptest2));
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'pktable_ptest1_key' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index "pktable_ptest1_key" for table "pktable"
|
||||
CREATE TABLE FKTABLE_FAIL1 (ftest1 int REFERENCES pktable(ptest1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: UNIQUE constraint matching given keys for referenced table "pktable" not found
|
||||
@@ -712,7 +712,7 @@ DROP TABLE PKTABLE;
|
||||
--
|
||||
-- Basic one column, two table setup
|
||||
CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
-- This next should fail, because inet=int does not exist
|
||||
CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
@@ -736,7 +736,7 @@ DROP TABLE FKTABLE;
|
||||
DROP TABLE PKTABLE;
|
||||
-- Two columns, two tables
|
||||
CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, PRIMARY KEY(ptest1, ptest2));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
-- This should fail, because we just chose really odd types
|
||||
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
@@ -775,33 +775,33 @@ DROP TABLE PKTABLE;
|
||||
-- Make sure this still works...
|
||||
CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3,
|
||||
ptest4) REFERENCES pktable(ptest1, ptest2));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
DROP TABLE PKTABLE;
|
||||
-- And this,
|
||||
CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3,
|
||||
ptest4) REFERENCES pktable);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
DROP TABLE PKTABLE;
|
||||
-- This shouldn't (mixed up columns)
|
||||
CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest3,
|
||||
ptest4) REFERENCES pktable(ptest2, ptest1));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: operator does not exist: integer = inet
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
-- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types
|
||||
CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4,
|
||||
ptest3) REFERENCES pktable(ptest1, ptest2));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: operator does not exist: inet = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
-- Not this one either... Same as the last one except we didn't defined the columns being referenced.
|
||||
CREATE TABLE PKTABLE (ptest1 int, ptest2 inet, ptest3 int, ptest4 inet, PRIMARY KEY(ptest1, ptest2), FOREIGN KEY(ptest4,
|
||||
ptest3) REFERENCES pktable);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: operator does not exist: inet = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
@@ -810,8 +810,8 @@ HINT: No operator matches the given name and argument type(s). You may need to
|
||||
-- Basic 2 table case: 1 column of matching types.
|
||||
create table pktable_base (base1 int not null);
|
||||
create table pktable (ptest1 int, primary key(base1), unique(base1, ptest1)) inherits (pktable_base);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'pktable_base1_key' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index "pktable_base1_key" for table "pktable"
|
||||
create table fktable (ftest1 int references pktable(base1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
-- now some ins, upd, del
|
||||
@@ -868,7 +868,7 @@ drop table pktable_base;
|
||||
create table pktable_base(base1 int not null, base2 int);
|
||||
create table pktable(ptest1 int, ptest2 int, primary key(base1, ptest1), foreign key(base2, ptest2) references
|
||||
pktable(base1, ptest1)) inherits (pktable_base);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
insert into pktable (base1, ptest1, base2, ptest2) values (1, 1, 1, 1);
|
||||
insert into pktable (base1, ptest1, base2, ptest2) values (2, 1, 1, 1);
|
||||
@@ -891,7 +891,7 @@ drop table pktable_base;
|
||||
-- 2 columns (2 tables), mismatched types
|
||||
create table pktable_base(base1 int not null);
|
||||
create table pktable(ptest1 inet, primary key(base1, ptest1)) inherits (pktable_base);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
-- just generally bad types (with and without column references on the referenced table)
|
||||
create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
@@ -920,25 +920,25 @@ drop table pktable_base;
|
||||
create table pktable_base(base1 int not null, base2 int);
|
||||
create table pktable(ptest1 inet, ptest2 inet[], primary key(base1, ptest1), foreign key(base2, ptest2) references
|
||||
pktable(base1, ptest1)) inherits (pktable_base);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: operator does not exist: inet[] = inet
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(base2, ptest2) references
|
||||
pktable(ptest1, base1)) inherits (pktable_base);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: operator does not exist: integer = inet
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references
|
||||
pktable(base1, ptest1)) inherits (pktable_base);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: operator does not exist: inet = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
create table pktable(ptest1 inet, ptest2 inet, primary key(base1, ptest1), foreign key(ptest2, base2) references
|
||||
pktable(base1, ptest1)) inherits (pktable_base);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: operator does not exist: inet = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
@@ -954,12 +954,12 @@ CREATE TABLE pktable (
|
||||
id INT4 PRIMARY KEY,
|
||||
other INT4
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE fktable (
|
||||
id INT4 PRIMARY KEY,
|
||||
fk INT4 REFERENCES pktable DEFERRABLE
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'fktable_pkey' for table 'fktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "fktable_pkey" for table "fktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
-- default to immediate: should fail
|
||||
INSERT INTO fktable VALUES (5, 10);
|
||||
@@ -976,12 +976,12 @@ CREATE TABLE pktable (
|
||||
id INT4 PRIMARY KEY,
|
||||
other INT4
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE fktable (
|
||||
id INT4 PRIMARY KEY,
|
||||
fk INT4 REFERENCES pktable DEFERRABLE INITIALLY DEFERRED
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'fktable_pkey' for table 'fktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "fktable_pkey" for table "fktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
-- default to deferred, should succeed
|
||||
BEGIN;
|
||||
@@ -1004,12 +1004,12 @@ CREATE TABLE pktable (
|
||||
id INT4 PRIMARY KEY,
|
||||
other INT4
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'pktable_pkey' for table 'pktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" for table "pktable"
|
||||
CREATE TABLE fktable (
|
||||
id INT4 PRIMARY KEY,
|
||||
fk INT4 REFERENCES pktable DEFERRABLE
|
||||
);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'fktable_pkey' for table 'fktable'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "fktable_pkey" for table "fktable"
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
BEGIN;
|
||||
SET CONSTRAINTS ALL DEFERRED;
|
||||
|
||||
@@ -806,9 +806,9 @@ SELECT interval '04:30' - time '01:02' AS "20:32:00";
|
||||
(1 row)
|
||||
|
||||
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
|
||||
ERROR: Cannot cast type time with time zone to interval
|
||||
ERROR: cannot cast type time with time zone to interval
|
||||
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
|
||||
ERROR: Cannot cast type interval to time with time zone
|
||||
ERROR: cannot cast type interval to time with time zone
|
||||
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
|
||||
23:29:00-08
|
||||
-------------
|
||||
|
||||
@@ -806,9 +806,9 @@ SELECT interval '04:30' - time '01:02' AS "20:32:00";
|
||||
(1 row)
|
||||
|
||||
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
|
||||
ERROR: Cannot cast type time with time zone to interval
|
||||
ERROR: cannot cast type time with time zone to interval
|
||||
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
|
||||
ERROR: Cannot cast type interval to time with time zone
|
||||
ERROR: cannot cast type interval to time with time zone
|
||||
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
|
||||
23:29:00-08
|
||||
-------------
|
||||
|
||||
@@ -806,9 +806,9 @@ SELECT interval '04:30' - time '01:02' AS "20:32:00";
|
||||
(1 row)
|
||||
|
||||
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
|
||||
ERROR: Cannot cast type time with time zone to interval
|
||||
ERROR: cannot cast type time with time zone to interval
|
||||
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
|
||||
ERROR: Cannot cast type interval to time with time zone
|
||||
ERROR: cannot cast type interval to time with time zone
|
||||
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
|
||||
23:29:00-08
|
||||
-------------
|
||||
|
||||
@@ -536,7 +536,7 @@ SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
|
||||
|
||||
-- Confirm PRIMARY KEY adds NOT NULL constraint to child table
|
||||
CREATE TEMP TABLE z (b TEXT, PRIMARY KEY(aa, b)) inherits (a);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'z_pkey' for table 'z'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "z_pkey" for table "z"
|
||||
INSERT INTO z VALUES (NULL, 'text'); -- should fail
|
||||
ERROR: ExecInsert: Fail to add null value in not null attribute aa
|
||||
-- Check UPDATE with inherited target and an inherited source table
|
||||
|
||||
@@ -336,7 +336,7 @@ SELECT '' AS "xxx", *
|
||||
-- ambiguous column
|
||||
SELECT '' AS "xxx", i, k, t
|
||||
FROM J1_TBL CROSS JOIN J2_TBL;
|
||||
ERROR: Column reference "i" is ambiguous
|
||||
ERROR: column reference "i" is ambiguous
|
||||
-- resolve previous ambiguity by specifying the table name
|
||||
SELECT '' AS "xxx", t1.i, k, t
|
||||
FROM J1_TBL t1 CROSS JOIN J2_TBL t2;
|
||||
|
||||
@@ -69,17 +69,19 @@ EXECUTE q3('AAAAxx', 5::smallint, 10.5::float, false, 500::oid, 4::bigint);
|
||||
|
||||
-- too few params
|
||||
EXECUTE q3('bool');
|
||||
ERROR: Wrong number of parameters, expected 6 but got 1
|
||||
ERROR: wrong number of parameters for prepared statement "q3"
|
||||
DETAIL: Expected 6 parameters but got 1.
|
||||
-- too many params
|
||||
EXECUTE q3('bytea', 5::smallint, 10.5::float, false, 500::oid, 4::bigint, true);
|
||||
ERROR: Wrong number of parameters, expected 6 but got 7
|
||||
ERROR: wrong number of parameters for prepared statement "q3"
|
||||
DETAIL: Expected 6 parameters but got 7.
|
||||
-- wrong param types
|
||||
EXECUTE q3(5::smallint, 10.5::float, false, 500::oid, 4::bigint, 'bytea');
|
||||
ERROR: Parameter $3 of type boolean cannot be coerced into the expected type double precision
|
||||
You will need to rewrite or cast the expression
|
||||
ERROR: parameter $3 of type boolean cannot be coerced to the expected type double precision
|
||||
HINT: You will need to rewrite or cast the expression.
|
||||
-- invalid type
|
||||
PREPARE q4(nonexistenttype) AS SELECT $1;
|
||||
ERROR: Type "nonexistenttype" does not exist
|
||||
ERROR: type "nonexistenttype" does not exist
|
||||
-- create table as execute
|
||||
PREPARE q5(int, text) AS
|
||||
SELECT * FROM tenk1 WHERE unique1 = $1 OR stringu1 = $2;
|
||||
|
||||
@@ -18,7 +18,7 @@ INSERT INTO foo2 VALUES(1, 111);
|
||||
CREATE FUNCTION foot(int) returns setof foo2 as 'SELECT * FROM foo2 WHERE fooid = $1;' LANGUAGE SQL;
|
||||
-- supposed to fail with ERROR
|
||||
select * from foo2, foot(foo2.fooid) z where foo2.f2 = z.f2;
|
||||
ERROR: FROM function expression may not refer to other relations of same query level
|
||||
ERROR: function expression in FROM may not refer to other relations of same query level
|
||||
-- function in subselect
|
||||
select * from foo2 where f2 in (select f2 from foot(foo2.fooid) z where z.fooid = foo2.fooid) ORDER BY 1,2;
|
||||
fooid | f2
|
||||
@@ -53,7 +53,7 @@ select foot.fooid, foot.f2 from foot(sin(pi()/2)::int) ORDER BY 1,2;
|
||||
(2 rows)
|
||||
|
||||
CREATE TABLE foo (fooid int, foosubid int, fooname text, primary key(fooid,foosubid));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'foo_pkey' for table 'foo'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo"
|
||||
INSERT INTO foo VALUES(1,1,'Joe');
|
||||
INSERT INTO foo VALUES(1,2,'Ed');
|
||||
INSERT INTO foo VALUES(2,1,'Mary');
|
||||
@@ -225,7 +225,7 @@ DROP TABLE foo2;
|
||||
DROP TABLE foo;
|
||||
-- Rescan tests --
|
||||
CREATE TABLE foorescan (fooid int, foosubid int, fooname text, primary key(fooid,foosubid));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'foorescan_pkey' for table 'foorescan'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foorescan_pkey" for table "foorescan"
|
||||
INSERT INTO foorescan values(5000,1,'abc.5000.1');
|
||||
INSERT INTO foorescan values(5001,1,'abc.5001.1');
|
||||
INSERT INTO foorescan values(5002,1,'abc.5002.1');
|
||||
@@ -311,7 +311,7 @@ SELECT * FROM foorescan f WHERE f.fooid IN (SELECT fooid FROM vw_foorescan) ORDE
|
||||
(10 rows)
|
||||
|
||||
CREATE TABLE barrescan (fooid int primary key);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'barrescan_pkey' for table 'barrescan'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "barrescan_pkey" for table "barrescan"
|
||||
INSERT INTO barrescan values(5003);
|
||||
INSERT INTO barrescan values(5004);
|
||||
INSERT INTO barrescan values(5005);
|
||||
|
||||
@@ -1180,7 +1180,7 @@ drop rule foorule on foo;
|
||||
-- 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);
|
||||
|
||||
@@ -44,7 +44,7 @@ SELECT count(*) FROM test_missing_target GROUP BY test_missing_target.c ORDER BY
|
||||
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
|
||||
-- failure expected
|
||||
SELECT count(*) FROM test_missing_target GROUP BY a ORDER BY b;
|
||||
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
|
||||
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
|
||||
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
|
||||
SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b;
|
||||
count
|
||||
@@ -120,7 +120,7 @@ ERROR: GROUP BY position 3 is not in target list
|
||||
SELECT count(*) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY b ORDER BY b;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- order w/ target under ambiguous condition
|
||||
-- failure NOT expected
|
||||
SELECT a, a FROM test_missing_target
|
||||
@@ -235,7 +235,7 @@ ORDER BY lower(test_missing_target.c);
|
||||
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
|
||||
-- failure expected
|
||||
SELECT count(a) FROM test_missing_target GROUP BY a ORDER BY b;
|
||||
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
|
||||
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
|
||||
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
|
||||
SELECT count(b) FROM test_missing_target GROUP BY b/2 ORDER BY b/2;
|
||||
count
|
||||
@@ -286,7 +286,7 @@ SELECT count(b) FROM test_missing_target
|
||||
SELECT count(x.a) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY b/2 ORDER BY b/2;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- group w/ existing GROUP BY target under ambiguous condition
|
||||
SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
@@ -303,7 +303,7 @@ SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
|
||||
SELECT count(b) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY x.b/2;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- group w/o existing GROUP BY target under ambiguous condition
|
||||
-- into a table
|
||||
SELECT count(x.b) INTO TABLE test_missing_target3
|
||||
|
||||
@@ -44,7 +44,7 @@ SELECT count(*) FROM test_missing_target GROUP BY test_missing_target.c ORDER BY
|
||||
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
|
||||
-- failure expected
|
||||
SELECT count(*) FROM test_missing_target GROUP BY a ORDER BY b;
|
||||
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
|
||||
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
|
||||
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
|
||||
SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b;
|
||||
count
|
||||
@@ -120,7 +120,7 @@ ERROR: GROUP BY position 3 is not in target list
|
||||
SELECT count(*) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY b ORDER BY b;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- order w/ target under ambiguous condition
|
||||
-- failure NOT expected
|
||||
SELECT a, a FROM test_missing_target
|
||||
@@ -235,7 +235,7 @@ ORDER BY lower(test_missing_target.c);
|
||||
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
|
||||
-- failure expected
|
||||
SELECT count(a) FROM test_missing_target GROUP BY a ORDER BY b;
|
||||
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
|
||||
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
|
||||
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
|
||||
SELECT count(b) FROM test_missing_target GROUP BY b/2 ORDER BY b/2;
|
||||
count
|
||||
@@ -286,7 +286,7 @@ SELECT count(b) FROM test_missing_target
|
||||
SELECT count(x.a) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY b/2 ORDER BY b/2;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- group w/ existing GROUP BY target under ambiguous condition
|
||||
SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
@@ -303,7 +303,7 @@ SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
|
||||
SELECT count(b) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY x.b/2;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- group w/o existing GROUP BY target under ambiguous condition
|
||||
-- into a table
|
||||
SELECT count(x.b) INTO TABLE test_missing_target3
|
||||
|
||||
@@ -44,7 +44,7 @@ SELECT count(*) FROM test_missing_target GROUP BY test_missing_target.c ORDER BY
|
||||
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
|
||||
-- failure expected
|
||||
SELECT count(*) FROM test_missing_target GROUP BY a ORDER BY b;
|
||||
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
|
||||
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
|
||||
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
|
||||
SELECT count(*) FROM test_missing_target GROUP BY b ORDER BY b;
|
||||
count
|
||||
@@ -120,7 +120,7 @@ ERROR: GROUP BY position 3 is not in target list
|
||||
SELECT count(*) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY b ORDER BY b;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- order w/ target under ambiguous condition
|
||||
-- failure NOT expected
|
||||
SELECT a, a FROM test_missing_target
|
||||
@@ -235,7 +235,7 @@ ORDER BY lower(test_missing_target.c);
|
||||
-- w/o existing GROUP BY target and w/o existing a different ORDER BY target
|
||||
-- failure expected
|
||||
SELECT count(a) FROM test_missing_target GROUP BY a ORDER BY b;
|
||||
ERROR: Attribute test_missing_target.b must be GROUPed or used in an aggregate function
|
||||
ERROR: attribute "test_missing_target.b" must be GROUPed or used in an aggregate function
|
||||
-- w/o existing GROUP BY target and w/o existing same ORDER BY target
|
||||
SELECT count(b) FROM test_missing_target GROUP BY b/2 ORDER BY b/2;
|
||||
count
|
||||
@@ -286,7 +286,7 @@ SELECT count(b) FROM test_missing_target
|
||||
SELECT count(x.a) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY b/2 ORDER BY b/2;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- group w/ existing GROUP BY target under ambiguous condition
|
||||
SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
@@ -303,7 +303,7 @@ SELECT x.b/2, count(x.b) FROM test_missing_target x, test_missing_target y
|
||||
SELECT count(b) FROM test_missing_target x, test_missing_target y
|
||||
WHERE x.a = y.a
|
||||
GROUP BY x.b/2;
|
||||
ERROR: Column reference "b" is ambiguous
|
||||
ERROR: column reference "b" is ambiguous
|
||||
-- group w/o existing GROUP BY target under ambiguous condition
|
||||
-- into a table
|
||||
SELECT count(x.b) INTO TABLE test_missing_target3
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
---
|
||||
|
||||
CREATE TABLE serialTest (f1 text, f2 serial);
|
||||
NOTICE: CREATE TABLE will create implicit sequence 'serialtest_f2_seq' for SERIAL column 'serialtest.f2'
|
||||
NOTICE: CREATE TABLE will create implicit sequence "serialtest_f2_seq" for SERIAL column "serialtest.f2"
|
||||
|
||||
INSERT INTO serialTest VALUES ('foo');
|
||||
INSERT INTO serialTest VALUES ('bar');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- Test basic TRUNCATE functionality.
|
||||
CREATE TABLE truncate_a (col1 integer primary key);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'truncate_a_pkey' for table 'truncate_a'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "truncate_a_pkey" for table "truncate_a"
|
||||
INSERT INTO truncate_a VALUES (1);
|
||||
INSERT INTO truncate_a VALUES (2);
|
||||
SELECT * FROM truncate_a;
|
||||
|
||||
@@ -404,7 +404,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
|
||||
|
||||
@@ -286,7 +286,7 @@ SELECT * FROM COPY_TBL;
|
||||
-- Primary keys
|
||||
--
|
||||
CREATE TABLE PRIMARY_TBL (i int PRIMARY KEY, t text);
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "primary_tbl_pkey" for table "primary_tbl"
|
||||
INSERT INTO PRIMARY_TBL VALUES (1, 'one');
|
||||
INSERT INTO PRIMARY_TBL VALUES (2, 'two');
|
||||
INSERT INTO PRIMARY_TBL VALUES (1, 'three');
|
||||
@@ -307,7 +307,7 @@ SELECT '' AS four, * FROM PRIMARY_TBL;
|
||||
DROP TABLE PRIMARY_TBL;
|
||||
CREATE TABLE PRIMARY_TBL (i int, t text,
|
||||
PRIMARY KEY(i,t));
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index 'primary_tbl_pkey' for table 'primary_tbl'
|
||||
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "primary_tbl_pkey" for table "primary_tbl"
|
||||
INSERT INTO PRIMARY_TBL VALUES (1, 'one');
|
||||
INSERT INTO PRIMARY_TBL VALUES (2, 'two');
|
||||
INSERT INTO PRIMARY_TBL VALUES (1, 'three');
|
||||
@@ -330,7 +330,7 @@ DROP TABLE PRIMARY_TBL;
|
||||
-- Unique keys
|
||||
--
|
||||
CREATE TABLE UNIQUE_TBL (i int UNIQUE, t text);
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'unique_tbl_i_key' for table 'unique_tbl'
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_key" for table "unique_tbl"
|
||||
INSERT INTO UNIQUE_TBL VALUES (1, 'one');
|
||||
INSERT INTO UNIQUE_TBL VALUES (2, 'two');
|
||||
INSERT INTO UNIQUE_TBL VALUES (1, 'three');
|
||||
@@ -353,7 +353,7 @@ SELECT '' AS five, * FROM UNIQUE_TBL;
|
||||
DROP TABLE UNIQUE_TBL;
|
||||
CREATE TABLE UNIQUE_TBL (i int, t text,
|
||||
UNIQUE(i,t));
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index 'unique_tbl_i_key' for table 'unique_tbl'
|
||||
NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_key" for table "unique_tbl"
|
||||
INSERT INTO UNIQUE_TBL VALUES (1, 'one');
|
||||
INSERT INTO UNIQUE_TBL VALUES (2, 'two');
|
||||
INSERT INTO UNIQUE_TBL VALUES (1, 'three');
|
||||
|
||||
@@ -13,8 +13,8 @@ CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE)
|
||||
RETURNS hobbies_r.person%TYPE
|
||||
AS 'select person from hobbies_r where name = $1'
|
||||
LANGUAGE 'sql';
|
||||
NOTICE: hobbies_r.person%TYPE converted to text
|
||||
NOTICE: hobbies_r.name%TYPE converted to text
|
||||
NOTICE: type reference hobbies_r.person%TYPE converted to text
|
||||
NOTICE: type reference hobbies_r.name%TYPE converted to text
|
||||
CREATE FUNCTION equipment(hobbies_r)
|
||||
RETURNS setof equipment_r
|
||||
AS 'select * from equipment_r where hobby = $1.name'
|
||||
|
||||
Reference in New Issue
Block a user