mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
Message editing: remove gratuitous variations in message wording, standardize
terms, add some clarifications, fix some untranslatable attempts at dynamic message building.
This commit is contained in:
@@ -29,12 +29,12 @@ INSERT INTO ABSTIME_TBL (f1) VALUES (abstime 'May 10, 1947 23:59:12');
|
||||
-- what happens if we specify slightly misformatted abstime?
|
||||
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 35, 1946 10:00:00');
|
||||
ERROR: date/time field value out of range: "Feb 35, 1946 10:00:00"
|
||||
HINT: Perhaps you need a different DateStyle setting.
|
||||
HINT: Perhaps you need a different "datestyle" setting.
|
||||
INSERT INTO ABSTIME_TBL (f1) VALUES ('Feb 28, 1984 25:08:10');
|
||||
ERROR: date/time field value out of range: "Feb 28, 1984 25:08:10"
|
||||
-- badly formatted abstimes: these should result in invalid abstimes
|
||||
INSERT INTO ABSTIME_TBL (f1) VALUES ('bad date format');
|
||||
ERROR: invalid input syntax for abstime: "bad date format"
|
||||
ERROR: invalid input syntax for type abstime: "bad date format"
|
||||
INSERT INTO ABSTIME_TBL (f1) VALUES ('Jun 10, 1843');
|
||||
-- test abstime operators
|
||||
SELECT '' AS eight, ABSTIME_TBL.*;
|
||||
|
||||
@@ -307,27 +307,27 @@ INSERT INTO tmp3 values (1,20);
|
||||
INSERT INTO tmp3 values (5,50);
|
||||
-- Try (and fail) to add constraint due to invalid source columns
|
||||
ALTER TABLE tmp3 add constraint tmpconstr foreign key(c) references tmp2 match full;
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: column "c" referenced in foreign key constraint does not exist
|
||||
-- Try (and fail) to add constraint due to invalide destination columns explicitly given
|
||||
ALTER TABLE tmp3 add constraint tmpconstr foreign key(a) references tmp2(b) match full;
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: column "b" referenced in foreign key constraint does not exist
|
||||
-- Try (and fail) to add constraint due to invalid data
|
||||
ALTER TABLE tmp3 add constraint tmpconstr foreign key (a) references tmp2 match full;
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: insert or update on "tmp3" violates foreign key constraint "tmpconstr"
|
||||
DETAIL: Key (a)=(5) is not present in "tmp2".
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: insert or update on table "tmp3" violates foreign key constraint "tmpconstr"
|
||||
DETAIL: Key (a)=(5) is not present in table "tmp2".
|
||||
-- Delete failing row
|
||||
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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
-- Try (and fail) to create constraint from tmp5(a) to tmp4(a) - unique constraint on
|
||||
-- tmp4 is a,b
|
||||
ALTER TABLE tmp5 add constraint tmpconstr foreign key(a) references tmp4(a) match full;
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ERROR: there is no UNIQUE constraint matching given keys for referenced table "tmp4"
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: there is no unique constraint matching given keys for referenced table "tmp4"
|
||||
DROP TABLE tmp5;
|
||||
DROP TABLE tmp4;
|
||||
DROP TABLE tmp3;
|
||||
@@ -340,24 +340,24 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo
|
||||
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;
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- This should also fail for the same reason, but here we
|
||||
-- give the column name
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- This should succeed, even though they are different types
|
||||
-- because varchar=int does exist
|
||||
DROP TABLE FKTABLE;
|
||||
CREATE TEMP TABLE FKTABLE (ftest1 varchar);
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
-- As should this
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
DROP TABLE pktable cascade;
|
||||
NOTICE: drop cascades to constraint $2 on table fktable
|
||||
NOTICE: drop cascades to constraint $1 on table fktable
|
||||
@@ -368,31 +368,31 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo
|
||||
-- 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;
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: operator does not exist: cidr = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
DROP TABLE FKTABLE;
|
||||
-- Again, so should this...
|
||||
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 timestamp);
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
|
||||
references pktable(ptest1, ptest2);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: operator does not exist: cidr = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
DROP TABLE FKTABLE;
|
||||
-- This fails because we mixed up the column ordering
|
||||
CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 inet);
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
|
||||
references pktable(ptest2, ptest1);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- As does this...
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1)
|
||||
references pktable(ptest1, ptest2);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- temp tables should go away by themselves, need not drop them.
|
||||
-- test check constraint adding
|
||||
create table atacc1 ( test int );
|
||||
@@ -400,7 +400,7 @@ create table atacc1 ( test int );
|
||||
alter table atacc1 add constraint atacc_test1 check (test>3);
|
||||
-- should fail
|
||||
insert into atacc1 (test) values (2);
|
||||
ERROR: new row for relation "atacc1" violates CHECK constraint "atacc_test1"
|
||||
ERROR: new row for relation "atacc1" violates check constraint "atacc_test1"
|
||||
-- should succeed
|
||||
insert into atacc1 (test) values (4);
|
||||
drop table atacc1;
|
||||
@@ -410,14 +410,14 @@ create table atacc1 ( test int );
|
||||
insert into atacc1 (test) values (2);
|
||||
-- add a check constraint (fails)
|
||||
alter table atacc1 add constraint atacc_test1 check (test>3);
|
||||
ERROR: CHECK constraint "atacc_test1" is violated at some row(s)
|
||||
ERROR: check constraint "atacc_test1" is violated by some row
|
||||
insert into atacc1 (test) values (4);
|
||||
drop table atacc1;
|
||||
-- let's do one where the check fails because the column doesn't exist
|
||||
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: column "test1" does not exist
|
||||
drop table atacc1;
|
||||
-- something a little more complicated
|
||||
create table atacc1 ( test int, test2 int, test3 int);
|
||||
@@ -425,7 +425,7 @@ create table atacc1 ( test int, test2 int, test3 int);
|
||||
alter table atacc1 add constraint atacc_test1 check (test+test2<test3*4);
|
||||
-- should fail
|
||||
insert into atacc1 (test,test2,test3) values (4,4,2);
|
||||
ERROR: new row for relation "atacc1" violates CHECK constraint "atacc_test1"
|
||||
ERROR: new row for relation "atacc1" violates check constraint "atacc_test1"
|
||||
-- should succeed
|
||||
insert into atacc1 (test,test2,test3) values (4,4,5);
|
||||
drop table atacc1;
|
||||
@@ -434,7 +434,7 @@ create table atacc1 (test int check (test>3), test2 int);
|
||||
alter table atacc1 add check (test2>test);
|
||||
-- should fail for $2
|
||||
insert into atacc1 (test2, test) values (3, 4);
|
||||
ERROR: new row for relation "atacc1" violates CHECK constraint "$1"
|
||||
ERROR: new row for relation "atacc1" violates check constraint "$1"
|
||||
drop table atacc1;
|
||||
-- inheritance related tests
|
||||
create table atacc1 (test int);
|
||||
@@ -443,11 +443,11 @@ create table atacc3 (test3 int) inherits (atacc1, atacc2);
|
||||
alter table atacc2 add constraint foo check (test2>0);
|
||||
-- fail and then succeed on atacc2
|
||||
insert into atacc2 (test2) values (-3);
|
||||
ERROR: new row for relation "atacc2" violates CHECK constraint "foo"
|
||||
ERROR: new row for relation "atacc2" violates check constraint "foo"
|
||||
insert into atacc2 (test2) values (3);
|
||||
-- fail and then succeed on atacc3
|
||||
insert into atacc3 (test2) values (-3);
|
||||
ERROR: new row for relation "atacc3" violates CHECK constraint "foo"
|
||||
ERROR: new row for relation "atacc3" violates check constraint "foo"
|
||||
insert into atacc3 (test2) values (3);
|
||||
drop table atacc3;
|
||||
drop table atacc2;
|
||||
@@ -459,7 +459,7 @@ create table atacc3 (test3 int) inherits (atacc1, atacc2);
|
||||
alter table only atacc2 add constraint foo check (test2>0);
|
||||
-- fail and then succeed on atacc2
|
||||
insert into atacc2 (test2) values (-3);
|
||||
ERROR: new row for relation "atacc2" violates CHECK constraint "foo"
|
||||
ERROR: new row for relation "atacc2" violates check constraint "foo"
|
||||
insert into atacc2 (test2) values (3);
|
||||
-- both succeed on atacc3
|
||||
insert into atacc3 (test2) values (-3);
|
||||
@@ -476,7 +476,7 @@ NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_test1" for t
|
||||
insert into atacc1 (test) values (2);
|
||||
-- should fail
|
||||
insert into atacc1 (test) values (2);
|
||||
ERROR: duplicate key violates UNIQUE constraint "atacc_test1"
|
||||
ERROR: duplicate key violates unique constraint "atacc_test1"
|
||||
-- should succeed
|
||||
insert into atacc1 (test) values (4);
|
||||
-- try adding a unique oid constraint
|
||||
@@ -511,7 +511,7 @@ NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc_test1" for t
|
||||
insert into atacc1 (test,test2) values (4,4);
|
||||
-- should fail
|
||||
insert into atacc1 (test,test2) values (4,4);
|
||||
ERROR: duplicate key violates UNIQUE constraint "atacc_test1"
|
||||
ERROR: duplicate key violates unique constraint "atacc_test1"
|
||||
-- should all succeed
|
||||
insert into atacc1 (test,test2) values (4,5);
|
||||
insert into atacc1 (test,test2) values (5,4);
|
||||
@@ -525,7 +525,7 @@ NOTICE: ALTER TABLE / ADD UNIQUE will create implicit index "atacc1_test2_key"
|
||||
-- should fail for @@ second one @@
|
||||
insert into atacc1 (test2, test) values (3, 3);
|
||||
insert into atacc1 (test2, test) values (2, 3);
|
||||
ERROR: duplicate key violates UNIQUE constraint "atacc1_test_key"
|
||||
ERROR: duplicate key violates unique constraint "atacc1_test_key"
|
||||
drop table atacc1;
|
||||
-- test primary key constraint adding
|
||||
create table atacc1 ( test int );
|
||||
@@ -536,12 +536,12 @@ NOTICE: ALTER TABLE / ADD PRIMARY KEY will create implicit index "atacc_test1"
|
||||
insert into atacc1 (test) values (2);
|
||||
-- should fail
|
||||
insert into atacc1 (test) values (2);
|
||||
ERROR: duplicate key violates UNIQUE constraint "atacc_test1"
|
||||
ERROR: duplicate key violates unique constraint "atacc_test1"
|
||||
-- should succeed
|
||||
insert into atacc1 (test) values (4);
|
||||
-- inserting NULL should fail
|
||||
insert into atacc1 (test) values(NULL);
|
||||
ERROR: null value for attribute "test" violates NOT NULL constraint
|
||||
ERROR: null value in column "test" violates not-null constraint
|
||||
-- try adding a second primary key (should fail)
|
||||
alter table atacc1 add constraint atacc_oid1 primary key(oid);
|
||||
ERROR: multiple primary keys for table "atacc1" are not allowed
|
||||
@@ -570,7 +570,7 @@ 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"
|
||||
ERROR: attribute "test" contains NULL values
|
||||
ERROR: column "test" contains null values
|
||||
insert into atacc1 (test) values (3);
|
||||
drop table atacc1;
|
||||
-- let's do one where the primary key constraint fails
|
||||
@@ -592,13 +592,13 @@ ERROR: multiple primary keys for table "atacc1" are not allowed
|
||||
insert into atacc1 (test,test2) values (4,4);
|
||||
-- should fail
|
||||
insert into atacc1 (test,test2) values (4,4);
|
||||
ERROR: duplicate key violates UNIQUE constraint "atacc_test1"
|
||||
ERROR: duplicate key violates unique constraint "atacc_test1"
|
||||
insert into atacc1 (test,test2) values (NULL,3);
|
||||
ERROR: null value for attribute "test" violates NOT NULL constraint
|
||||
ERROR: null value in column "test" violates not-null constraint
|
||||
insert into atacc1 (test,test2) values (3, NULL);
|
||||
ERROR: null value for attribute "test2" violates NOT NULL constraint
|
||||
ERROR: null value in column "test2" violates not-null constraint
|
||||
insert into atacc1 (test,test2) values (NULL,NULL);
|
||||
ERROR: null value for attribute "test" violates NOT NULL constraint
|
||||
ERROR: null value in column "test" violates not-null constraint
|
||||
-- should all succeed
|
||||
insert into atacc1 (test,test2) values (4,5);
|
||||
insert into atacc1 (test,test2) values (5,4);
|
||||
@@ -610,9 +610,9 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "atacc1_pkey" for
|
||||
-- only first should succeed
|
||||
insert into atacc1 (test2, test) values (3, 3);
|
||||
insert into atacc1 (test2, test) values (2, 3);
|
||||
ERROR: duplicate key violates UNIQUE constraint "atacc1_pkey"
|
||||
ERROR: duplicate key violates unique constraint "atacc1_pkey"
|
||||
insert into atacc1 (test2, test) values (1, NULL);
|
||||
ERROR: null value for attribute "test" violates NOT NULL constraint
|
||||
ERROR: null value in column "test" violates not-null constraint
|
||||
drop table atacc1;
|
||||
-- alter table / alter column [set/drop] not null tests
|
||||
-- try altering system catalogs, should fail
|
||||
@@ -631,24 +631,24 @@ 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"
|
||||
alter table atacc1 alter column test drop not null;
|
||||
ERROR: attribute "test" is in a primary key
|
||||
ERROR: column "test" is in a primary key
|
||||
alter table atacc1 drop constraint "atacc1_pkey";
|
||||
alter table atacc1 alter column test drop not null;
|
||||
insert into atacc1 values (null);
|
||||
alter table atacc1 alter test set not null;
|
||||
ERROR: attribute "test" contains NULL values
|
||||
ERROR: column "test" contains null values
|
||||
delete from atacc1;
|
||||
alter table atacc1 alter test set not null;
|
||||
-- try altering a non-existent column, should fail
|
||||
alter table atacc1 alter bar set not null;
|
||||
ERROR: attribute "bar" of relation "atacc1" does not exist
|
||||
ERROR: column "bar" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter bar drop not null;
|
||||
ERROR: attribute "bar" of relation "atacc1" does not exist
|
||||
ERROR: column "bar" of relation "atacc1" does not exist
|
||||
-- try altering the oid column, should fail
|
||||
alter table atacc1 alter oid set not null;
|
||||
ERROR: cannot alter system attribute "oid"
|
||||
ERROR: cannot alter system column "oid"
|
||||
alter table atacc1 alter oid drop not null;
|
||||
ERROR: cannot alter system attribute "oid"
|
||||
ERROR: cannot alter system column "oid"
|
||||
-- try creating a view and altering that, should fail
|
||||
create view myview as select * from atacc1;
|
||||
alter table myview alter column test drop not null;
|
||||
@@ -662,27 +662,27 @@ create table parent (a int);
|
||||
create table child (b varchar(255)) inherits (parent);
|
||||
alter table parent alter a set not null;
|
||||
insert into parent values (NULL);
|
||||
ERROR: null value for attribute "a" violates NOT NULL constraint
|
||||
ERROR: null value in column "a" violates not-null constraint
|
||||
insert into child (a, b) values (NULL, 'foo');
|
||||
ERROR: null value for attribute "a" violates NOT NULL constraint
|
||||
ERROR: null value in column "a" violates not-null constraint
|
||||
alter table parent alter a drop not null;
|
||||
insert into parent values (NULL);
|
||||
insert into child (a, b) values (NULL, 'foo');
|
||||
alter table only parent alter a set not null;
|
||||
ERROR: attribute "a" contains NULL values
|
||||
ERROR: column "a" contains null values
|
||||
alter table child alter a set not null;
|
||||
ERROR: attribute "a" contains NULL values
|
||||
ERROR: column "a" contains null values
|
||||
delete from parent;
|
||||
alter table only parent alter a set not null;
|
||||
insert into parent values (NULL);
|
||||
ERROR: null value for attribute "a" violates NOT NULL constraint
|
||||
ERROR: null value in column "a" violates not-null constraint
|
||||
alter table child alter a set not null;
|
||||
insert into child (a, b) values (NULL, 'foo');
|
||||
ERROR: null value for attribute "a" violates NOT NULL constraint
|
||||
ERROR: null value in column "a" violates not-null constraint
|
||||
delete from child;
|
||||
alter table child alter a set not null;
|
||||
insert into child (a, b) values (NULL, 'foo');
|
||||
ERROR: null value for attribute "a" violates NOT NULL constraint
|
||||
ERROR: null value in column "a" violates not-null constraint
|
||||
drop table child;
|
||||
drop table parent;
|
||||
-- test setting and removing default values
|
||||
@@ -713,7 +713,7 @@ ERROR: invalid input syntax for integer: "wrong_datatype"
|
||||
alter table def_test alter column c2 set default 20;
|
||||
-- set defaults on a non-existent column: this should fail
|
||||
alter table def_test alter column c3 set default 30;
|
||||
ERROR: attribute "c3" of relation "def_test" does not exist
|
||||
ERROR: column "c3" of relation "def_test" does not exist
|
||||
-- set defaults on views: we need to create a view, add a rule
|
||||
-- to allow insertions into it, and then alter the view to add
|
||||
-- a default
|
||||
@@ -753,7 +753,7 @@ create table atacc1 (a int4 not null, b int4, c int4 not null, d int4);
|
||||
insert into atacc1 values (1, 2, 3, 4);
|
||||
alter table atacc1 drop a;
|
||||
alter table atacc1 drop a;
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
-- SELECTs
|
||||
select * from atacc1;
|
||||
b | c | d
|
||||
@@ -762,13 +762,13 @@ select * from atacc1;
|
||||
(1 row)
|
||||
|
||||
select * from atacc1 order by a;
|
||||
ERROR: attribute "a" not found
|
||||
ERROR: column "a" does not exist
|
||||
select * from atacc1 order by "........pg.dropped.1........";
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
select * from atacc1 group by a;
|
||||
ERROR: attribute "a" not found
|
||||
ERROR: column "a" does not exist
|
||||
select * from atacc1 group by "........pg.dropped.1........";
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
select atacc1.* from atacc1;
|
||||
b | c | d
|
||||
---+---+---
|
||||
@@ -776,9 +776,9 @@ select atacc1.* from atacc1;
|
||||
(1 row)
|
||||
|
||||
select a from atacc1;
|
||||
ERROR: attribute "a" not found
|
||||
ERROR: column "a" does not exist
|
||||
select atacc1.a from atacc1;
|
||||
ERROR: no such attribute atacc1.a
|
||||
ERROR: column atacc1.a does not exist
|
||||
select b,c,d from atacc1;
|
||||
b | c | d
|
||||
---+---+---
|
||||
@@ -786,26 +786,26 @@ select b,c,d from atacc1;
|
||||
(1 row)
|
||||
|
||||
select a,b,c,d from atacc1;
|
||||
ERROR: attribute "a" not found
|
||||
ERROR: column "a" does not exist
|
||||
select * from atacc1 where a = 1;
|
||||
ERROR: attribute "a" not found
|
||||
ERROR: column "a" does not exist
|
||||
select "........pg.dropped.1........" from atacc1;
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
select atacc1."........pg.dropped.1........" from atacc1;
|
||||
ERROR: no such attribute atacc1.........pg.dropped.1........
|
||||
ERROR: column atacc1.........pg.dropped.1........ does not exist
|
||||
select "........pg.dropped.1........",b,c,d from atacc1;
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
select * from atacc1 where "........pg.dropped.1........" = 1;
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
-- UPDATEs
|
||||
update atacc1 set a = 3;
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
update atacc1 set b = 2 where a = 3;
|
||||
ERROR: attribute "a" not found
|
||||
ERROR: column "a" does not exist
|
||||
update atacc1 set "........pg.dropped.1........" = 3;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
update atacc1 set b = 2 where "........pg.dropped.1........" = 3;
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
-- INSERTs
|
||||
insert into atacc1 values (10, 11, 12, 13);
|
||||
ERROR: INSERT has more expressions than target columns
|
||||
@@ -813,34 +813,34 @@ 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: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
insert into atacc1 (a) values (default);
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
insert into atacc1 (a,b,c,d) values (10,11,12,13);
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
insert into atacc1 (a,b,c,d) values (default,11,12,13);
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
insert into atacc1 (b,c,d) values (11,12,13);
|
||||
insert into atacc1 ("........pg.dropped.1........") values (10);
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
insert into atacc1 ("........pg.dropped.1........") values (default);
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
insert into atacc1 ("........pg.dropped.1........",b,c,d) values (10,11,12,13);
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
insert into atacc1 ("........pg.dropped.1........",b,c,d) values (default,11,12,13);
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
-- DELETEs
|
||||
delete from atacc1 where a = 3;
|
||||
ERROR: attribute "a" not found
|
||||
ERROR: column "a" does not exist
|
||||
delete from atacc1 where "........pg.dropped.1........" = 3;
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
delete from atacc1;
|
||||
-- try dropping a non-existent column, should fail
|
||||
alter table atacc1 drop bar;
|
||||
ERROR: attribute "bar" of relation "atacc1" does not exist
|
||||
ERROR: column "bar" of relation "atacc1" does not exist
|
||||
-- try dropping the oid column, should fail
|
||||
alter table atacc1 drop oid;
|
||||
ERROR: cannot drop system attribute "oid"
|
||||
ERROR: cannot drop system column "oid"
|
||||
-- try creating a view and altering that, should fail
|
||||
create view myview as select * from atacc1;
|
||||
select * from myview;
|
||||
@@ -853,45 +853,45 @@ ERROR: "myview" is not a table
|
||||
drop view myview;
|
||||
-- test some commands to make sure they fail on the dropped column
|
||||
analyze atacc1(a);
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
analyze atacc1("........pg.dropped.1........");
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
vacuum analyze atacc1(a);
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
vacuum analyze atacc1("........pg.dropped.1........");
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
comment on column atacc1.a is 'testing';
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
comment on column atacc1."........pg.dropped.1........" is 'testing';
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter a set storage plain;
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter "........pg.dropped.1........" set storage plain;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter a set statistics 0;
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter "........pg.dropped.1........" set statistics 0;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter a set default 3;
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter "........pg.dropped.1........" set default 3;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter a drop default;
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter "........pg.dropped.1........" drop default;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter a set not null;
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter "........pg.dropped.1........" set not null;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter a drop not null;
|
||||
ERROR: attribute "a" of relation "atacc1" does not exist
|
||||
ERROR: column "a" of relation "atacc1" does not exist
|
||||
alter table atacc1 alter "........pg.dropped.1........" drop not null;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "atacc1" does not exist
|
||||
alter table atacc1 rename a to x;
|
||||
ERROR: attribute "a" does not exist
|
||||
ERROR: column "a" does not exist
|
||||
alter table atacc1 rename "........pg.dropped.1........" to x;
|
||||
ERROR: attribute "........pg.dropped.1........" does not exist
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
alter table atacc1 add primary key(a);
|
||||
ERROR: column "a" named in key does not exist
|
||||
alter table atacc1 add primary key("........pg.dropped.1........");
|
||||
@@ -901,28 +901,28 @@ ERROR: column "a" named in key does not exist
|
||||
alter table atacc1 add unique("........pg.dropped.1........");
|
||||
ERROR: column "........pg.dropped.1........" named in key does not exist
|
||||
alter table atacc1 add check (a > 3);
|
||||
ERROR: attribute "a" not found
|
||||
ERROR: column "a" does not exist
|
||||
alter table atacc1 add check ("........pg.dropped.1........" > 3);
|
||||
ERROR: attribute "........pg.dropped.1........" not found
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
create table atacc2 (id int4 unique);
|
||||
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)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: column "a" referenced in foreign key constraint does not exist
|
||||
alter table atacc1 add foreign key ("........pg.dropped.1........") references atacc2(id);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: column "........pg.dropped.1........" referenced in foreign key constraint does not exist
|
||||
alter table atacc2 add foreign key (id) references atacc1(a);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: column "a" referenced in foreign key constraint does not exist
|
||||
alter table atacc2 add foreign key (id) references atacc1("........pg.dropped.1........");
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: ALTER TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: column "........pg.dropped.1........" referenced in foreign key constraint does not exist
|
||||
drop table atacc2;
|
||||
create index "testing_idx" on atacc1(a);
|
||||
ERROR: attribute "a" does not exist
|
||||
ERROR: column "a" does not exist
|
||||
create index "testing_idx" on atacc1("........pg.dropped.1........");
|
||||
ERROR: attribute "........pg.dropped.1........" does not exist
|
||||
ERROR: column "........pg.dropped.1........" does not exist
|
||||
-- test create as and select into
|
||||
insert into atacc1 values (21, 22, 23);
|
||||
create table test1 as select * from atacc1;
|
||||
@@ -993,9 +993,9 @@ alter table test drop a;
|
||||
copy test to stdout;
|
||||
2 3
|
||||
copy test(a) to stdout;
|
||||
ERROR: attribute "a" of relation "test" does not exist
|
||||
ERROR: column "a" of relation "test" does not exist
|
||||
copy test("........pg.dropped.1........") to stdout;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "test" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "test" does not exist
|
||||
copy test from stdin;
|
||||
ERROR: extra data after last expected column
|
||||
CONTEXT: COPY FROM, line 1
|
||||
@@ -1014,9 +1014,9 @@ select * from test;
|
||||
(2 rows)
|
||||
|
||||
copy test(a) from stdin;
|
||||
ERROR: attribute "a" of relation "test" does not exist
|
||||
ERROR: column "a" of relation "test" does not exist
|
||||
copy test("........pg.dropped.1........") from stdin;
|
||||
ERROR: attribute "........pg.dropped.1........" of relation "test" does not exist
|
||||
ERROR: column "........pg.dropped.1........" of relation "test" does not exist
|
||||
copy test(b,c) from stdin;
|
||||
select * from test;
|
||||
b | c
|
||||
@@ -1033,9 +1033,9 @@ create table dropColumnChild (c int) inherits (dropColumn);
|
||||
create table dropColumnAnother (d int) inherits (dropColumnChild);
|
||||
-- these two should fail
|
||||
alter table dropColumnchild drop column a;
|
||||
ERROR: cannot drop inherited attribute "a"
|
||||
ERROR: cannot drop inherited column "a"
|
||||
alter table only dropColumnChild drop column b;
|
||||
ERROR: cannot drop inherited attribute "b"
|
||||
ERROR: cannot drop inherited column "b"
|
||||
-- these three should work
|
||||
alter table only dropColumn drop column e;
|
||||
alter table dropColumnChild drop column c;
|
||||
@@ -1045,11 +1045,11 @@ create table renameColumnChild (b int) inherits (renameColumn);
|
||||
create table renameColumnAnother (c int) inherits (renameColumnChild);
|
||||
-- these three should fail
|
||||
alter table renameColumnChild rename column a to d;
|
||||
ERROR: cannot rename inherited attribute "a"
|
||||
ERROR: cannot rename inherited column "a"
|
||||
alter table only renameColumnChild rename column a to d;
|
||||
ERROR: inherited attribute "a" must be renamed in child tables too
|
||||
ERROR: inherited column "a" must be renamed in child tables too
|
||||
alter table only renameColumn rename column a to d;
|
||||
ERROR: inherited attribute "a" must be renamed in child tables too
|
||||
ERROR: inherited column "a" must be renamed in child tables too
|
||||
-- these should work
|
||||
alter table renameColumn rename column a to d;
|
||||
alter table renameColumnChild rename column b to a;
|
||||
@@ -1057,14 +1057,14 @@ alter table renameColumnChild rename column b to a;
|
||||
alter table renameColumn add column w int;
|
||||
-- this should fail
|
||||
alter table only renameColumn add column x int;
|
||||
ERROR: attribute must be added to child tables too
|
||||
ERROR: column must be added to child tables too
|
||||
-- Test corner cases in dropping of inherited columns
|
||||
create table p1 (f1 int, f2 int);
|
||||
create table c1 (f1 int not null) inherits(p1);
|
||||
NOTICE: merging attribute "f1" with inherited definition
|
||||
NOTICE: merging column "f1" with inherited definition
|
||||
-- should be rejected since c1.f1 is inherited
|
||||
alter table c1 drop column f1;
|
||||
ERROR: cannot drop inherited attribute "f1"
|
||||
ERROR: cannot drop inherited column "f1"
|
||||
-- should work
|
||||
alter table p1 drop column f1;
|
||||
-- c1.f1 is still there, but no longer inherited
|
||||
@@ -1075,25 +1075,25 @@ select f1 from c1;
|
||||
|
||||
alter table c1 drop column f1;
|
||||
select f1 from c1;
|
||||
ERROR: attribute "f1" not found
|
||||
ERROR: column "f1" does not exist
|
||||
drop table p1 cascade;
|
||||
NOTICE: drop cascades to table c1
|
||||
create table p1 (f1 int, f2 int);
|
||||
create table c1 () inherits(p1);
|
||||
-- should be rejected since c1.f1 is inherited
|
||||
alter table c1 drop column f1;
|
||||
ERROR: cannot drop inherited attribute "f1"
|
||||
ERROR: 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: column "f1" does not exist
|
||||
drop table p1 cascade;
|
||||
NOTICE: drop cascades to table c1
|
||||
create table p1 (f1 int, f2 int);
|
||||
create table c1 () inherits(p1);
|
||||
-- should be rejected since c1.f1 is inherited
|
||||
alter table c1 drop column f1;
|
||||
ERROR: cannot drop inherited attribute "f1"
|
||||
ERROR: cannot drop inherited column "f1"
|
||||
alter table only p1 drop column f1;
|
||||
-- c1.f1 is NOT dropped, but must now be considered non-inherited
|
||||
alter table c1 drop column f1;
|
||||
@@ -1101,10 +1101,10 @@ drop table p1 cascade;
|
||||
NOTICE: drop cascades to table c1
|
||||
create table p1 (f1 int, f2 int);
|
||||
create table c1 (f1 int not null) inherits(p1);
|
||||
NOTICE: merging attribute "f1" with inherited definition
|
||||
NOTICE: merging column "f1" with inherited definition
|
||||
-- should be rejected since c1.f1 is inherited
|
||||
alter table c1 drop column f1;
|
||||
ERROR: cannot drop inherited attribute "f1"
|
||||
ERROR: cannot drop inherited column "f1"
|
||||
alter table only p1 drop column f1;
|
||||
-- c1.f1 is still there, but no longer inherited
|
||||
alter table c1 drop column f1;
|
||||
@@ -1113,7 +1113,7 @@ NOTICE: drop cascades to table c1
|
||||
create table p1(id int, name text);
|
||||
create table p2(id2 int, name text, height int);
|
||||
create table c1(age int) inherits(p1,p2);
|
||||
NOTICE: merging multiple inherited definitions of attribute "name"
|
||||
NOTICE: merging multiple inherited definitions of column "name"
|
||||
create table gc1() inherits (c1);
|
||||
select relname, attname, attinhcount, attislocal
|
||||
from pg_class join pg_attribute on (pg_class.oid = pg_attribute.attrelid)
|
||||
@@ -1144,12 +1144,12 @@ alter table only p1 drop column name;
|
||||
alter table p2 drop column name;
|
||||
-- should be rejected since its inherited
|
||||
alter table gc1 drop column name;
|
||||
ERROR: cannot drop inherited attribute "name"
|
||||
ERROR: cannot drop inherited column "name"
|
||||
-- should work, and drop gc1.name along
|
||||
alter table c1 drop column name;
|
||||
-- should fail: column does not exist
|
||||
alter table gc1 drop column name;
|
||||
ERROR: attribute "name" of relation "gc1" does not exist
|
||||
ERROR: column "name" of relation "gc1" does not exist
|
||||
-- should work and drop the attribute in all tables
|
||||
alter table p2 drop column height;
|
||||
select relname, attname, attinhcount, attislocal
|
||||
@@ -1184,7 +1184,7 @@ select oid > 0, * from altstartwith;
|
||||
|
||||
alter table altstartwith set without oids;
|
||||
select oid > 0, * from altstartwith; -- fails
|
||||
ERROR: attribute "oid" not found
|
||||
ERROR: column "oid" does not exist
|
||||
select * from altstartwith;
|
||||
col
|
||||
-----
|
||||
@@ -1211,9 +1211,9 @@ select oid > 0, * from altinhoid;
|
||||
alter table altwithoid set without oids;
|
||||
alter table altinhoid set without oids;
|
||||
select oid > 0, * from altwithoid; -- fails
|
||||
ERROR: attribute "oid" not found
|
||||
ERROR: column "oid" does not exist
|
||||
select oid > 0, * from altinhoid; -- fails
|
||||
ERROR: attribute "oid" not found
|
||||
ERROR: column "oid" does not exist
|
||||
select * from altwithoid;
|
||||
col
|
||||
-----
|
||||
@@ -1234,7 +1234,7 @@ alter table p1 add column f2 text;
|
||||
NOTICE: merging definition of column "f2" for child "c1"
|
||||
insert into p1 values (1,2,'abc');
|
||||
insert into c1 values(11,'xyz',33,0); -- should fail
|
||||
ERROR: new row for relation "c1" violates CHECK constraint "p1_a1"
|
||||
ERROR: new row for relation "c1" violates check constraint "p1_a1"
|
||||
insert into c1 values(11,'xyz',33,22);
|
||||
select * from p1;
|
||||
f1 | a1 | f2
|
||||
|
||||
@@ -363,7 +363,7 @@ insert into arr_tbl values ('{1,2,3}');
|
||||
insert into arr_tbl values ('{1,2}');
|
||||
-- failure expected:
|
||||
insert into arr_tbl values ('{1,2,3}');
|
||||
ERROR: duplicate key violates UNIQUE constraint "arr_tbl_f1_key"
|
||||
ERROR: duplicate key violates unique constraint "arr_tbl_f1_key"
|
||||
insert into arr_tbl values ('{2,3,4}');
|
||||
insert into arr_tbl values ('{1,5,3}');
|
||||
insert into arr_tbl values ('{1,2,10}');
|
||||
|
||||
@@ -112,7 +112,7 @@ INSERT INTO BOOLTBL2 (f1) VALUES (bool 'FALSE');
|
||||
-- For pre-v6.3 this evaluated to false - thomas 1997-10-23
|
||||
INSERT INTO BOOLTBL2 (f1)
|
||||
VALUES (bool 'XXX');
|
||||
ERROR: invalid input syntax for boolean: "XXX"
|
||||
ERROR: invalid input syntax for type boolean: "XXX"
|
||||
-- BOOLTBL2 should be full of false's at this point
|
||||
SELECT '' AS f_4, BOOLTBL2.*;
|
||||
f_4 | f1
|
||||
|
||||
@@ -24,9 +24,9 @@ INSERT INTO BOX_TBL (f1) VALUES ('(2.5, 2.5, 2.5,3.5)');
|
||||
INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)');
|
||||
-- badly formatted box inputs
|
||||
INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)');
|
||||
ERROR: invalid input syntax for box: "(2.3, 4.5)"
|
||||
ERROR: invalid input syntax for type box: "(2.3, 4.5)"
|
||||
INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
|
||||
ERROR: invalid input syntax for box: "asdfasdf(ad"
|
||||
ERROR: invalid input syntax for type box: "asdfasdf(ad"
|
||||
SELECT '' AS four, BOX_TBL.*;
|
||||
four | f1
|
||||
------+---------------------
|
||||
|
||||
@@ -10,11 +10,11 @@ INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10>');
|
||||
INSERT INTO CIRCLE_TBL VALUES ('<(100,1),115>');
|
||||
-- bad values
|
||||
INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
|
||||
ERROR: invalid input syntax for circle: "<(-100,0),-100>"
|
||||
ERROR: invalid input syntax for type circle: "<(-100,0),-100>"
|
||||
INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
|
||||
ERROR: invalid input syntax for circle: "1abc,3,5"
|
||||
ERROR: invalid input syntax for type circle: "1abc,3,5"
|
||||
INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
|
||||
ERROR: invalid input syntax for circle: "(3,(1,2),3)"
|
||||
ERROR: invalid input syntax for type circle: "(3,(1,2),3)"
|
||||
SELECT * FROM CIRCLE_TBL;
|
||||
f1
|
||||
----------------
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
--
|
||||
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 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 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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
CREATE INDEX clstr_tst_b ON clstr_tst (b);
|
||||
CREATE INDEX clstr_tst_c ON clstr_tst (c);
|
||||
CREATE INDEX clstr_tst_c_b ON clstr_tst (c,b);
|
||||
@@ -248,8 +248,8 @@ SELECT a,b,c,substring(d for 30), length(d) from clstr_tst;
|
||||
|
||||
-- Verify that foreign key link still works
|
||||
INSERT INTO clstr_tst (b, c) VALUES (1111, 'this should fail');
|
||||
ERROR: insert or update on "clstr_tst" violates foreign key constraint "clstr_tst_con"
|
||||
DETAIL: Key (b)=(1111) is not present in "clstr_tst_s".
|
||||
ERROR: insert or update on table "clstr_tst" violates foreign key constraint "clstr_tst_con"
|
||||
DETAIL: Key (b)=(1111) is not present in table "clstr_tst_s".
|
||||
SELECT conname FROM pg_constraint WHERE conrelid = 'clstr_tst'::regclass;
|
||||
conname
|
||||
----------------
|
||||
|
||||
@@ -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,10 +28,10 @@ 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: attribute "xyz" of relation "x" does not exist
|
||||
ERROR: column "xyz" of relation "x" does not exist
|
||||
-- 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
|
||||
ERROR: column "d" specified more than once
|
||||
-- missing data: should fail
|
||||
COPY x from stdin;
|
||||
ERROR: invalid input syntax for integer: ""
|
||||
|
||||
@@ -78,7 +78,7 @@ INSERT INTO func_index_heap VALUES('AB','CDEFG');
|
||||
INSERT INTO func_index_heap VALUES('QWE','RTY');
|
||||
-- this should fail because of unique index:
|
||||
INSERT INTO func_index_heap VALUES('ABCD', 'EF');
|
||||
ERROR: duplicate key violates UNIQUE constraint "func_index_index"
|
||||
ERROR: duplicate key violates unique constraint "func_index_index"
|
||||
-- but this shouldn't:
|
||||
INSERT INTO func_index_heap VALUES('QWERTY');
|
||||
--
|
||||
@@ -92,7 +92,7 @@ INSERT INTO func_index_heap VALUES('AB','CDEFG');
|
||||
INSERT INTO func_index_heap VALUES('QWE','RTY');
|
||||
-- this should fail because of unique index:
|
||||
INSERT INTO func_index_heap VALUES('ABCD', 'EF');
|
||||
ERROR: duplicate key violates UNIQUE constraint "func_index_index"
|
||||
ERROR: duplicate key violates unique constraint "func_index_index"
|
||||
-- but this shouldn't:
|
||||
INSERT INTO func_index_heap VALUES('QWERTY');
|
||||
--
|
||||
|
||||
@@ -81,9 +81,9 @@ CREATE TABLE student (
|
||||
CREATE TABLE stud_emp (
|
||||
percent int4
|
||||
) INHERITS (emp, student);
|
||||
NOTICE: merging multiple inherited definitions of attribute "name"
|
||||
NOTICE: merging multiple inherited definitions of attribute "age"
|
||||
NOTICE: merging multiple inherited definitions of attribute "location"
|
||||
NOTICE: merging multiple inherited definitions of column "name"
|
||||
NOTICE: merging multiple inherited definitions of column "age"
|
||||
NOTICE: merging multiple inherited definitions of column "location"
|
||||
CREATE TABLE city (
|
||||
name name,
|
||||
location box,
|
||||
@@ -135,8 +135,8 @@ CREATE TABLE c_star (
|
||||
CREATE TABLE d_star (
|
||||
d float8
|
||||
) INHERITS (b_star, c_star);
|
||||
NOTICE: merging multiple inherited definitions of attribute "class"
|
||||
NOTICE: merging multiple inherited definitions of attribute "a"
|
||||
NOTICE: merging multiple inherited definitions of column "class"
|
||||
NOTICE: merging multiple inherited definitions of column "a"
|
||||
CREATE TABLE e_star (
|
||||
e int2
|
||||
) INHERITS (c_star);
|
||||
|
||||
@@ -111,26 +111,26 @@ create table nulltest
|
||||
, col5 dcheck CHECK (col5 IN ('c', 'd'))
|
||||
);
|
||||
INSERT INTO nulltest DEFAULT VALUES;
|
||||
ERROR: domain dnotnull does not allow NULL values
|
||||
ERROR: domain dnotnull does not allow null values
|
||||
INSERT INTO nulltest values ('a', 'b', 'c', 'd', 'c'); -- Good
|
||||
insert into nulltest values ('a', 'b', 'c', 'd', NULL);
|
||||
ERROR: domain dcheck does not allow NULL values
|
||||
ERROR: domain dcheck does not allow null values
|
||||
insert into nulltest values ('a', 'b', 'c', 'd', 'a');
|
||||
ERROR: new row for relation "nulltest" violates CHECK constraint "nulltest_col5"
|
||||
ERROR: new row for relation "nulltest" violates check constraint "nulltest_col5"
|
||||
INSERT INTO nulltest values (NULL, 'b', 'c', 'd', 'd');
|
||||
ERROR: domain dnotnull does not allow NULL values
|
||||
ERROR: domain dnotnull does not allow null values
|
||||
INSERT INTO nulltest values ('a', NULL, 'c', 'd', 'c');
|
||||
ERROR: domain dnotnull does not allow NULL values
|
||||
ERROR: domain dnotnull does not allow null values
|
||||
INSERT INTO nulltest values ('a', 'b', NULL, 'd', 'c');
|
||||
ERROR: null value for attribute "col3" violates NOT NULL constraint
|
||||
ERROR: null value in column "col3" violates not-null constraint
|
||||
INSERT INTO nulltest values ('a', 'b', 'c', NULL, 'd'); -- Good
|
||||
-- Test copy
|
||||
COPY nulltest FROM stdin; --fail
|
||||
ERROR: domain dcheck does not allow NULL values
|
||||
ERROR: domain dcheck does not allow null values
|
||||
CONTEXT: COPY FROM, line 1
|
||||
-- Last row is bad
|
||||
COPY nulltest FROM stdin;
|
||||
ERROR: new row for relation "nulltest" violates CHECK constraint "nulltest_col5"
|
||||
ERROR: new row for relation "nulltest" violates check constraint "nulltest_col5"
|
||||
CONTEXT: COPY FROM, line 3
|
||||
select * from nulltest;
|
||||
col1 | col2 | col3 | col4 | col5
|
||||
@@ -147,11 +147,11 @@ SELECT cast('1' as dnotnull);
|
||||
(1 row)
|
||||
|
||||
SELECT cast(NULL as dnotnull); -- fail
|
||||
ERROR: domain dnotnull does not allow NULL values
|
||||
ERROR: domain dnotnull does not allow null values
|
||||
SELECT cast(cast(NULL as dnull) as dnotnull); -- fail
|
||||
ERROR: domain dnotnull does not allow NULL values
|
||||
ERROR: domain dnotnull does not allow null values
|
||||
SELECT cast(col4 as dnotnull) from nulltest; -- fail
|
||||
ERROR: domain dnotnull does not allow NULL values
|
||||
ERROR: domain dnotnull does not allow null values
|
||||
-- cleanup
|
||||
drop table nulltest;
|
||||
drop domain dnotnull restrict;
|
||||
@@ -199,14 +199,14 @@ create table domnotnull
|
||||
);
|
||||
insert into domnotnull default values;
|
||||
alter domain dnotnulltest set not null; -- fails
|
||||
ERROR: relation "domnotnull" attribute "col1" contains NULL values
|
||||
ERROR: column "col1" of table "domnotnull" contains null values
|
||||
update domnotnull set col1 = 5;
|
||||
alter domain dnotnulltest set not null; -- fails
|
||||
ERROR: relation "domnotnull" attribute "col2" contains NULL values
|
||||
ERROR: column "col2" of table "domnotnull" contains null values
|
||||
update domnotnull set col2 = 6;
|
||||
alter domain dnotnulltest set not null;
|
||||
update domnotnull set col1 = null; -- fails
|
||||
ERROR: domain dnotnulltest does not allow NULL values
|
||||
ERROR: domain dnotnulltest does not allow null values
|
||||
alter domain dnotnulltest drop not null;
|
||||
update domnotnull set col1 = null;
|
||||
drop domain dnotnulltest cascade;
|
||||
@@ -247,17 +247,17 @@ create table domcontest (col1 con);
|
||||
insert into domcontest values (1);
|
||||
insert into domcontest values (2);
|
||||
alter domain con add constraint t check (VALUE < 1); -- fails
|
||||
ERROR: relation "domcontest" attribute "col1" contains values that violate the new constraint
|
||||
ERROR: relation "domcontest" column "col1" contains values that violate the new constraint
|
||||
alter domain con add constraint t check (VALUE < 34);
|
||||
alter domain con add check (VALUE > 0);
|
||||
insert into domcontest values (-5); -- fails
|
||||
ERROR: value for domain con violates CHECK constraint "$1"
|
||||
ERROR: value for domain con violates check constraint "$1"
|
||||
insert into domcontest values (42); -- fails
|
||||
ERROR: value for domain con violates CHECK constraint "t"
|
||||
ERROR: value for domain con violates check constraint "t"
|
||||
insert into domcontest values (5);
|
||||
alter domain con drop constraint t;
|
||||
insert into domcontest values (-5); --fails
|
||||
ERROR: value for domain con violates CHECK constraint "$1"
|
||||
ERROR: value for domain con violates check constraint "$1"
|
||||
insert into domcontest values (42);
|
||||
-- Confirm ALTER DOMAIN with RULES.
|
||||
create table domtab (col1 integer);
|
||||
@@ -274,7 +274,7 @@ select * from domview;
|
||||
|
||||
alter domain dom set not null;
|
||||
select * from domview; -- fail
|
||||
ERROR: domain dom does not allow NULL values
|
||||
ERROR: domain dom does not allow null values
|
||||
alter domain dom drop not null;
|
||||
select * from domview;
|
||||
col1
|
||||
@@ -285,7 +285,7 @@ select * from domview;
|
||||
|
||||
alter domain dom add constraint domchkgt6 check(value > 6);
|
||||
select * from domview; --fail
|
||||
ERROR: value for domain dom violates CHECK constraint "domchkgt6"
|
||||
ERROR: value for domain dom violates check constraint "domchkgt6"
|
||||
alter domain dom drop constraint domchkgt6 restrict;
|
||||
select * from domview;
|
||||
col1
|
||||
|
||||
@@ -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: column "nonesuch" does not exist
|
||||
-- bad attribute name on lhs of operator
|
||||
select * from pg_database where nonesuch = pg_database.datname;
|
||||
ERROR: attribute "nonesuch" not found
|
||||
ERROR: column "nonesuch" does not exist
|
||||
-- bad attribute name on rhs of operator
|
||||
select * from pg_database where pg_database.datname = nonesuch;
|
||||
ERROR: attribute "nonesuch" not found
|
||||
ERROR: column "nonesuch" does not exist
|
||||
-- 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: column "foobar" does not exist
|
||||
--
|
||||
-- DELETE
|
||||
|
||||
@@ -87,13 +87,13 @@ alter table nonesuchrel rename column nonesuchatt to newnonesuchatt;
|
||||
ERROR: relation "nonesuchrel" does not exist
|
||||
-- no such attribute
|
||||
alter table emp rename column nonesuchatt to newnonesuchatt;
|
||||
ERROR: attribute "nonesuchatt" does not exist
|
||||
ERROR: column "nonesuchatt" does not exist
|
||||
-- conflict
|
||||
alter table emp rename column salary to manager;
|
||||
ERROR: attribute "manager" of relation "stud_emp" already exists
|
||||
ERROR: column "manager" of relation "stud_emp" already exists
|
||||
-- conflict
|
||||
alter table emp rename column salary to oid;
|
||||
ERROR: attribute "oid" of relation "stud_emp" already exists
|
||||
ERROR: column "oid" of relation "stud_emp" already exists
|
||||
--
|
||||
-- TRANSACTION STUFF
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e+20');
|
||||
INSERT INTO FLOAT4_TBL(f1) VALUES ('1.2345678901234e-20');
|
||||
-- test for over and under flow
|
||||
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e40');
|
||||
ERROR: float4 value out of range: overflow
|
||||
ERROR: type "real" value out of range: overflow
|
||||
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e40');
|
||||
ERROR: float4 value out of range: overflow
|
||||
ERROR: type "real" value out of range: overflow
|
||||
INSERT INTO FLOAT4_TBL(f1) VALUES ('10e-40');
|
||||
ERROR: float4 value out of range: underflow
|
||||
ERROR: type "real" value out of range: underflow
|
||||
INSERT INTO FLOAT4_TBL(f1) VALUES ('-10e-40');
|
||||
ERROR: float4 value out of range: underflow
|
||||
ERROR: type "real" value out of range: underflow
|
||||
SELECT '' AS five, FLOAT4_TBL.*;
|
||||
five | f1
|
||||
------+-------------
|
||||
|
||||
@@ -247,13 +247,13 @@ UPDATE FLOAT8_TBL
|
||||
SET f1 = FLOAT8_TBL.f1 * '-1'
|
||||
WHERE FLOAT8_TBL.f1 > '0.0';
|
||||
SELECT '' AS bad, f.f1 * '1e200' from FLOAT8_TBL f;
|
||||
ERROR: float8 value out of range: overflow
|
||||
ERROR: type "double precision" value out of range: overflow
|
||||
SELECT '' AS bad, f.f1 ^ '1e200' from FLOAT8_TBL f;
|
||||
ERROR: result is out of range
|
||||
SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 = '0.0' ;
|
||||
ERROR: cannot take log of zero
|
||||
ERROR: cannot take logarithm of zero
|
||||
SELECT '' AS bad, ln(f.f1) from FLOAT8_TBL f where f.f1 < '0.0' ;
|
||||
ERROR: cannot take log of a negative number
|
||||
ERROR: cannot take logarithm of a negative number
|
||||
SELECT '' AS bad, exp(f.f1) from FLOAT8_TBL f;
|
||||
ERROR: result is out of range
|
||||
SELECT '' AS bad, f.f1 / '0.0' from FLOAT8_TBL f;
|
||||
@@ -270,13 +270,13 @@ SELECT '' AS five, FLOAT8_TBL.*;
|
||||
|
||||
-- test for over- and underflow
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e400');
|
||||
ERROR: "10e400" is out of range for float8
|
||||
ERROR: "10e400" is out of range for type double precision
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e400');
|
||||
ERROR: "-10e400" is out of range for float8
|
||||
ERROR: "-10e400" is out of range for type double precision
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('10e-400');
|
||||
ERROR: "10e-400" is out of range for float8
|
||||
ERROR: "10e-400" is out of range for type double precision
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES ('-10e-400');
|
||||
ERROR: "-10e-400" is out of range for float8
|
||||
ERROR: "-10e-400" is out of range for type double precision
|
||||
-- maintain external table consistency across platforms
|
||||
-- delete all values and reinsert well-behaved ones
|
||||
DELETE FROM FLOAT8_TBL;
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text );
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- Insert test data into PKTABLE
|
||||
INSERT INTO PKTABLE VALUES (1, 'Test1');
|
||||
INSERT INTO PKTABLE VALUES (2, 'Test2');
|
||||
@@ -22,8 +22,8 @@ INSERT INTO FKTABLE VALUES (3, 4);
|
||||
INSERT INTO FKTABLE VALUES (NULL, 1);
|
||||
-- Insert a failed row into FK TABLE
|
||||
INSERT INTO FKTABLE VALUES (100, 2);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (ftest1)=(100) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (ftest1)=(100) is not present in table "pktable".
|
||||
-- Check FKTABLE
|
||||
SELECT * FROM FKTABLE;
|
||||
ftest1 | ftest2
|
||||
@@ -65,7 +65,7 @@ CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1,
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- Insert test data into PKTABLE
|
||||
INSERT INTO PKTABLE VALUES (1, 2, 'Test1');
|
||||
INSERT INTO PKTABLE VALUES (1, 3, 'Test1-2');
|
||||
@@ -81,17 +81,17 @@ INSERT INTO FKTABLE VALUES (3, 6, 12);
|
||||
INSERT INTO FKTABLE VALUES (NULL, NULL, 0);
|
||||
-- Insert failed rows into FK TABLE
|
||||
INSERT INTO FKTABLE VALUES (100, 2, 4);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname"
|
||||
DETAIL: Key (ftest1,ftest2)=(100,2) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname"
|
||||
DETAIL: Key (ftest1,ftest2)=(100,2) is not present in table "pktable".
|
||||
INSERT INTO FKTABLE VALUES (2, 2, 4);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname"
|
||||
DETAIL: Key (ftest1,ftest2)=(2,2) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname"
|
||||
DETAIL: Key (ftest1,ftest2)=(2,2) is not present in table "pktable".
|
||||
INSERT INTO FKTABLE VALUES (NULL, 2, 4);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname"
|
||||
DETAIL: MATCH FULL does not allow mixing of NULL and non-NULL key values.
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname"
|
||||
DETAIL: MATCH FULL does not allow mixing of null and nonnull key values.
|
||||
INSERT INTO FKTABLE VALUES (1, NULL, 4);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname"
|
||||
DETAIL: MATCH FULL does not allow mixing of NULL and non-NULL key values.
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname"
|
||||
DETAIL: MATCH FULL does not allow mixing of null and nonnull key values.
|
||||
-- Check FKTABLE
|
||||
SELECT * FROM FKTABLE;
|
||||
ftest1 | ftest2 | ftest3
|
||||
@@ -152,7 +152,7 @@ CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 text, PRIMARY KEY(ptest1,
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- Insert a value in PKTABLE for default
|
||||
INSERT INTO PKTABLE VALUES (-1, -2, 'The Default!');
|
||||
-- Insert test data into PKTABLE
|
||||
@@ -170,17 +170,17 @@ INSERT INTO FKTABLE VALUES (3, 6, 12);
|
||||
INSERT INTO FKTABLE VALUES (NULL, NULL, 0);
|
||||
-- Insert failed rows into FK TABLE
|
||||
INSERT INTO FKTABLE VALUES (100, 2, 4);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname2"
|
||||
DETAIL: Key (ftest1,ftest2)=(100,2) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname2"
|
||||
DETAIL: Key (ftest1,ftest2)=(100,2) is not present in table "pktable".
|
||||
INSERT INTO FKTABLE VALUES (2, 2, 4);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname2"
|
||||
DETAIL: Key (ftest1,ftest2)=(2,2) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname2"
|
||||
DETAIL: Key (ftest1,ftest2)=(2,2) is not present in table "pktable".
|
||||
INSERT INTO FKTABLE VALUES (NULL, 2, 4);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname2"
|
||||
DETAIL: MATCH FULL does not allow mixing of NULL and non-NULL key values.
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname2"
|
||||
DETAIL: MATCH FULL does not allow mixing of null and nonnull key values.
|
||||
INSERT INTO FKTABLE VALUES (1, NULL, 4);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname2"
|
||||
DETAIL: MATCH FULL does not allow mixing of NULL and non-NULL key values.
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname2"
|
||||
DETAIL: MATCH FULL does not allow mixing of null and nonnull key values.
|
||||
-- Check FKTABLE
|
||||
SELECT * FROM FKTABLE;
|
||||
ftest1 | ftest2 | ftest3
|
||||
@@ -245,7 +245,7 @@ DROP TABLE FKTABLE;
|
||||
CREATE TABLE PKTABLE ( ptest1 int PRIMARY KEY, ptest2 text );
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- Insert test data into PKTABLE
|
||||
INSERT INTO PKTABLE VALUES (1, 'Test1');
|
||||
INSERT INTO PKTABLE VALUES (2, 'Test2');
|
||||
@@ -259,8 +259,8 @@ INSERT INTO FKTABLE VALUES (3, 4);
|
||||
INSERT INTO FKTABLE VALUES (NULL, 1);
|
||||
-- Insert a failed row into FK TABLE
|
||||
INSERT INTO FKTABLE VALUES (100, 2);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (ftest1)=(100) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (ftest1)=(100) is not present in table "pktable".
|
||||
-- Check FKTABLE
|
||||
SELECT * FROM FKTABLE;
|
||||
ftest1 | ftest2
|
||||
@@ -285,7 +285,7 @@ SELECT * FROM PKTABLE;
|
||||
-- Delete a row from PK TABLE (should fail)
|
||||
DELETE FROM PKTABLE WHERE ptest1=1;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable"
|
||||
DETAIL: Key (ptest1)=(1) is still referenced from "fktable".
|
||||
DETAIL: Key (ptest1)=(1) is still referenced from table "fktable".
|
||||
-- Delete a row from PK TABLE (should succeed)
|
||||
DELETE FROM PKTABLE WHERE ptest1=5;
|
||||
-- Check PKTABLE for deletes
|
||||
@@ -301,7 +301,7 @@ SELECT * FROM PKTABLE;
|
||||
-- Update a row from PK TABLE (should fail)
|
||||
UPDATE PKTABLE SET ptest1=0 WHERE ptest1=2;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable"
|
||||
DETAIL: Key (ptest1)=(2) is still referenced from "fktable".
|
||||
DETAIL: Key (ptest1)=(2) is still referenced from table "fktable".
|
||||
-- Update a row from PK TABLE (should succeed)
|
||||
UPDATE PKTABLE SET ptest1=0 WHERE ptest1=4;
|
||||
-- Check PKTABLE for updates
|
||||
@@ -322,7 +322,7 @@ CREATE TABLE PKTABLE ( ptest1 int, ptest2 int, ptest3 int, ptest4 text, PRIMARY
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- Insert Primary Key values
|
||||
INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1');
|
||||
INSERT INTO PKTABLE VALUES (1, 3, 3, 'test2');
|
||||
@@ -336,8 +336,8 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4);
|
||||
INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5);
|
||||
-- Insert a failed values
|
||||
INSERT INTO FKTABLE VALUES (1, 2, 7, 6);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in table "pktable".
|
||||
-- Show FKTABLE
|
||||
SELECT * from FKTABLE;
|
||||
ftest1 | ftest2 | ftest3 | ftest4
|
||||
@@ -352,13 +352,13 @@ SELECT * from FKTABLE;
|
||||
-- Try to update something that should fail
|
||||
UPDATE PKTABLE set ptest2=5 where ptest2=2;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "constrname3" on "fktable"
|
||||
DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from "fktable".
|
||||
DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from table "fktable".
|
||||
-- Try to update something that should succeed
|
||||
UPDATE PKTABLE set ptest1=1 WHERE ptest2=3;
|
||||
-- Try to delete something that should fail
|
||||
DELETE FROM PKTABLE where ptest1=1 and ptest2=2 and ptest3=3;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "constrname3" on "fktable"
|
||||
DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from "fktable".
|
||||
DETAIL: Key (ptest1,ptest2,ptest3)=(1,2,3) is still referenced from table "fktable".
|
||||
-- Try to delete something that should work
|
||||
DELETE FROM PKTABLE where ptest1=2;
|
||||
-- Show PKTABLE and FKTABLE
|
||||
@@ -388,7 +388,7 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo
|
||||
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);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- Insert Primary Key values
|
||||
INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1');
|
||||
INSERT INTO PKTABLE VALUES (1, 3, 3, 'test2');
|
||||
@@ -402,8 +402,8 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4);
|
||||
INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5);
|
||||
-- Insert a failed values
|
||||
INSERT INTO FKTABLE VALUES (1, 2, 7, 6);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in table "pktable".
|
||||
-- Show FKTABLE
|
||||
SELECT * from FKTABLE;
|
||||
ftest1 | ftest2 | ftest3 | ftest4
|
||||
@@ -486,7 +486,7 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo
|
||||
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);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- Insert Primary Key values
|
||||
INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1');
|
||||
INSERT INTO PKTABLE VALUES (1, 3, 3, 'test2');
|
||||
@@ -501,8 +501,8 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4);
|
||||
INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5);
|
||||
-- Insert a failed values
|
||||
INSERT INTO FKTABLE VALUES (1, 2, 7, 6);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in table "pktable".
|
||||
-- Show FKTABLE
|
||||
SELECT * from FKTABLE;
|
||||
ftest1 | ftest2 | ftest3 | ftest4
|
||||
@@ -591,7 +591,7 @@ NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "pktable_pkey" fo
|
||||
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);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- Insert Primary Key values
|
||||
INSERT INTO PKTABLE VALUES (1, 2, 3, 'test1');
|
||||
INSERT INTO PKTABLE VALUES (1, 3, 3, 'test2');
|
||||
@@ -608,8 +608,8 @@ INSERT INTO FKTABLE VALUES (NULL, 2, 7, 4);
|
||||
INSERT INTO FKTABLE VALUES (NULL, 3, 4, 5);
|
||||
-- Insert a failed values
|
||||
INSERT INTO FKTABLE VALUES (1, 2, 7, 6);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,2,7) is not present in table "pktable".
|
||||
-- Show FKTABLE
|
||||
SELECT * from FKTABLE;
|
||||
ftest1 | ftest2 | ftest3 | ftest4
|
||||
@@ -625,8 +625,8 @@ SELECT * from FKTABLE;
|
||||
|
||||
-- Try to update something that will fail
|
||||
UPDATE PKTABLE set ptest2=5 where ptest2=2;
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,-1,3) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "constrname3"
|
||||
DETAIL: Key (ftest1,ftest2,ftest3)=(1,-1,3) is not present in table "pktable".
|
||||
-- Try to update something that will set default
|
||||
UPDATE PKTABLE set ptest1=0, ptest2=5, ptest3=10 where ptest2=2;
|
||||
UPDATE PKTABLE set ptest2=10 where ptest2=4;
|
||||
@@ -707,10 +707,10 @@ DROP TABLE PKTABLE;
|
||||
CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY);
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: column "ftest2" referenced in foreign key constraint does not exist
|
||||
CREATE TABLE FKTABLE_FAIL2 ( ftest1 int, CONSTRAINT fkfail1 FOREIGN KEY (ftest1) REFERENCES PKTABLE(ptest2));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: column "ptest2" referenced in foreign key constraint does not exist
|
||||
DROP TABLE FKTABLE_FAIL1;
|
||||
ERROR: table "fktable_fail1" does not exist
|
||||
@@ -721,8 +721,8 @@ DROP TABLE PKTABLE;
|
||||
CREATE TABLE PKTABLE (ptest1 int, ptest2 int, UNIQUE(ptest1, ptest2));
|
||||
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: there is no UNIQUE constraint matching given keys for referenced table "pktable"
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: there is no unique constraint matching given keys for referenced table "pktable"
|
||||
DROP TABLE FKTABLE_FAIL1;
|
||||
ERROR: table "fktable_fail1" does not exist
|
||||
DROP TABLE PKTABLE;
|
||||
@@ -734,23 +734,23 @@ CREATE TABLE PKTABLE (ptest1 int PRIMARY KEY);
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- This should also fail for the same reason, but here we
|
||||
-- give the column name
|
||||
CREATE TABLE FKTABLE (ftest1 inet REFERENCES pktable(ptest1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- This should succeed, even though they are different types
|
||||
-- because varchar=int does exist
|
||||
CREATE TABLE FKTABLE (ftest1 varchar REFERENCES pktable);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
DROP TABLE FKTABLE;
|
||||
-- As should this
|
||||
CREATE TABLE FKTABLE (ftest1 varchar REFERENCES pktable(ptest1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
DROP TABLE FKTABLE;
|
||||
DROP TABLE PKTABLE;
|
||||
-- Two columns, two tables
|
||||
@@ -758,36 +758,36 @@ 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"
|
||||
-- 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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: operator does not exist: cidr = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- Again, so should this...
|
||||
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 timestamp, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: operator does not exist: cidr = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- This fails because we mixed up the column ordering
|
||||
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- As does this...
|
||||
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest1, ptest2));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- And again..
|
||||
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest2, ptest1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- This works...
|
||||
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest2, ptest1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
DROP TABLE FKTABLE;
|
||||
-- As does this
|
||||
CREATE TABLE FKTABLE (ftest1 int, ftest2 inet, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
DROP TABLE FKTABLE;
|
||||
DROP TABLE PKTABLE;
|
||||
-- Two columns, same table
|
||||
@@ -795,35 +795,35 @@ DROP TABLE PKTABLE;
|
||||
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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- 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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- 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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
--
|
||||
-- Now some cases with inheritance
|
||||
-- Basic 2 table case: 1 column of matching types.
|
||||
@@ -832,26 +832,26 @@ create table pktable (ptest1 int, primary key(base1), unique(base1, ptest1)) inh
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- now some ins, upd, del
|
||||
insert into pktable(base1) values (1);
|
||||
insert into pktable(base1) values (2);
|
||||
-- let's insert a non-existant fktable value
|
||||
insert into fktable(ftest1) values (3);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (ftest1)=(3) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (ftest1)=(3) is not present in table "pktable".
|
||||
-- let's make a valid row for that
|
||||
insert into pktable(base1) values (3);
|
||||
insert into fktable(ftest1) values (3);
|
||||
-- let's try removing a row that should fail from pktable
|
||||
delete from pktable where base1>2;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable"
|
||||
DETAIL: Key (base1)=(3) is still referenced from "fktable".
|
||||
DETAIL: Key (base1)=(3) is still referenced from table "fktable".
|
||||
-- okay, let's try updating all of the base1 values to *4
|
||||
-- which should fail.
|
||||
update pktable set base1=base1*4;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable"
|
||||
DETAIL: Key (base1)=(3) is still referenced from "fktable".
|
||||
DETAIL: Key (base1)=(3) is still referenced from table "fktable".
|
||||
-- okay, let's try an update that should work.
|
||||
update pktable set base1=base1*4 where base1<3;
|
||||
-- and a delete that should work
|
||||
@@ -861,26 +861,26 @@ drop table fktable;
|
||||
delete from pktable;
|
||||
-- Now 2 columns 2 tables, matching types
|
||||
create table fktable (ftest1 int, ftest2 int, foreign key(ftest1, ftest2) references pktable(base1, ptest1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- now some ins, upd, del
|
||||
insert into pktable(base1, ptest1) values (1, 1);
|
||||
insert into pktable(base1, ptest1) values (2, 2);
|
||||
-- let's insert a non-existant fktable value
|
||||
insert into fktable(ftest1, ftest2) values (3, 1);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (ftest1,ftest2)=(3,1) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (ftest1,ftest2)=(3,1) is not present in table "pktable".
|
||||
-- let's make a valid row for that
|
||||
insert into pktable(base1,ptest1) values (3, 1);
|
||||
insert into fktable(ftest1, ftest2) values (3, 1);
|
||||
-- let's try removing a row that should fail from pktable
|
||||
delete from pktable where base1>2;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable"
|
||||
DETAIL: Key (base1,ptest1)=(3,1) is still referenced from "fktable".
|
||||
DETAIL: Key (base1,ptest1)=(3,1) is still referenced from table "fktable".
|
||||
-- okay, let's try updating all of the base1 values to *4
|
||||
-- which should fail.
|
||||
update pktable set base1=base1*4;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "fktable"
|
||||
DETAIL: Key (base1,ptest1)=(3,1) is still referenced from "fktable".
|
||||
DETAIL: Key (base1,ptest1)=(3,1) is still referenced from table "fktable".
|
||||
-- okay, let's try an update that should work.
|
||||
update pktable set base1=base1*4 where base1<3;
|
||||
-- and a delete that should work
|
||||
@@ -894,23 +894,23 @@ 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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
insert into pktable (base1, ptest1, base2, ptest2) values (1, 1, 1, 1);
|
||||
insert into pktable (base1, ptest1, base2, ptest2) values (2, 1, 1, 1);
|
||||
insert into pktable (base1, ptest1, base2, ptest2) values (2, 2, 2, 1);
|
||||
insert into pktable (base1, ptest1, base2, ptest2) values (1, 3, 2, 2);
|
||||
-- fails (3,2) isn't in base1, ptest1
|
||||
insert into pktable (base1, ptest1, base2, ptest2) values (2, 3, 3, 2);
|
||||
ERROR: insert or update on "pktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (base2,ptest2)=(3,2) is not present in "pktable".
|
||||
ERROR: insert or update on table "pktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (base2,ptest2)=(3,2) is not present in table "pktable".
|
||||
-- fails (2,2) is being referenced
|
||||
delete from pktable where base1=2;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "pktable"
|
||||
DETAIL: Key (base1,ptest1)=(2,2) is still referenced from "pktable".
|
||||
DETAIL: Key (base1,ptest1)=(2,2) is still referenced from table "pktable".
|
||||
-- fails (1,1) is being referenced (twice)
|
||||
update pktable set base1=3 where base1=1;
|
||||
ERROR: update or delete on "pktable" violates foreign key constraint "$1" on "pktable"
|
||||
DETAIL: Key (base1,ptest1)=(1,1) is still referenced from "pktable".
|
||||
DETAIL: Key (base1,ptest1)=(1,1) is still referenced from table "pktable".
|
||||
-- this sequence of two deletes will work, since after the first there will be no (2,*) references
|
||||
delete from pktable where base2=2;
|
||||
delete from pktable where base1=2;
|
||||
@@ -922,26 +922,26 @@ create table pktable(ptest1 inet, primary key(base1, ptest1)) inherits (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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: operator does not exist: cidr = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
create table fktable(ftest1 cidr, ftest2 int[], foreign key (ftest1, ftest2) references pktable(base1, ptest1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
ERROR: operator does not exist: cidr = integer
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
-- let's mix up which columns reference which
|
||||
create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
create table fktable(ftest1 int, ftest2 inet, foreign key(ftest2, ftest1) references pktable(base1, ptest1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
create table fktable(ftest1 int, ftest2 inet, foreign key(ftest1, ftest2) references pktable(ptest1, base1));
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
drop table pktable;
|
||||
drop table pktable_base;
|
||||
-- 2 columns (1 table), mismatched types
|
||||
@@ -949,27 +949,27 @@ 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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
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 will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
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.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
drop table pktable;
|
||||
ERROR: table "pktable" does not exist
|
||||
drop table pktable_base;
|
||||
@@ -988,11 +988,11 @@ CREATE TABLE fktable (
|
||||
fk INT4 REFERENCES pktable DEFERRABLE
|
||||
);
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- default to immediate: should fail
|
||||
INSERT INTO fktable VALUES (5, 10);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (fk)=(10) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (fk)=(10) is not present in table "pktable".
|
||||
-- explicitely defer the constraint
|
||||
BEGIN;
|
||||
SET CONSTRAINTS ALL DEFERRED;
|
||||
@@ -1011,7 +1011,7 @@ CREATE TABLE fktable (
|
||||
fk INT4 REFERENCES pktable DEFERRABLE INITIALLY DEFERRED
|
||||
);
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
-- default to deferred, should succeed
|
||||
BEGIN;
|
||||
INSERT INTO fktable VALUES (100, 200);
|
||||
@@ -1022,8 +1022,8 @@ BEGIN;
|
||||
SET CONSTRAINTS ALL IMMEDIATE;
|
||||
-- should fail
|
||||
INSERT INTO fktable VALUES (500, 1000);
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (fk)=(1000) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (fk)=(1000) is not present in table "pktable".
|
||||
COMMIT;
|
||||
DROP TABLE fktable, pktable;
|
||||
-- tricky behavior: according to SQL99, if a deferred constraint is set
|
||||
@@ -1040,17 +1040,17 @@ CREATE TABLE fktable (
|
||||
fk INT4 REFERENCES pktable DEFERRABLE
|
||||
);
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
BEGIN;
|
||||
SET CONSTRAINTS ALL DEFERRED;
|
||||
-- should succeed, for now
|
||||
INSERT INTO fktable VALUES (1000, 2000);
|
||||
-- should cause transaction abort, due to preceding error
|
||||
SET CONSTRAINTS ALL IMMEDIATE;
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (fk)=(2000) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (fk)=(2000) is not present in table "pktable".
|
||||
INSERT INTO pktable VALUES (2000, 3); -- too late
|
||||
ERROR: current transaction is aborted, queries ignored until end of transaction block
|
||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||
COMMIT;
|
||||
DROP TABLE fktable, pktable;
|
||||
-- deferrable, initially deferred
|
||||
@@ -1064,11 +1064,11 @@ CREATE TABLE fktable (
|
||||
fk INT4 REFERENCES pktable DEFERRABLE INITIALLY DEFERRED
|
||||
);
|
||||
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)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
BEGIN;
|
||||
-- no error here
|
||||
INSERT INTO fktable VALUES (100, 200);
|
||||
-- error here on commit
|
||||
COMMIT;
|
||||
ERROR: insert or update on "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (fk)=(200) is not present in "pktable".
|
||||
ERROR: insert or update on table "fktable" violates foreign key constraint "$1"
|
||||
DETAIL: Key (fk)=(200) is not present in table "pktable".
|
||||
|
||||
@@ -82,7 +82,7 @@ SELECT timestamp with time zone '12/27/2001 04:05:06.789-08';
|
||||
-- should fail in mdy mode:
|
||||
SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
|
||||
ERROR: date/time field value out of range: "27/12/2001 04:05:06.789-08"
|
||||
HINT: Perhaps you need a different DateStyle setting.
|
||||
HINT: Perhaps you need a different "datestyle" setting.
|
||||
set datestyle to dmy;
|
||||
SELECT timestamp with time zone '27/12/2001 04:05:06.789-08';
|
||||
timestamptz
|
||||
@@ -306,7 +306,7 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
|
||||
|
||||
SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
|
||||
ERROR: operator does not exist: date - time with time zone
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit typecasts.
|
||||
HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts.
|
||||
--
|
||||
-- timestamp, interval arithmetic
|
||||
--
|
||||
@@ -2356,7 +2356,7 @@ SELECT '' AS two, d1 AS "timestamp", abstime(d1) AS abstime
|
||||
|
||||
SELECT '' AS three, f1 as abstime, cast(f1 as timestamp) AS "timestamp"
|
||||
FROM ABSTIME_TBL WHERE NOT isfinite(f1);
|
||||
ERROR: cannot convert "invalid" abstime to timestamp
|
||||
ERROR: cannot convert abstime "invalid" to timestamp
|
||||
SELECT '' AS ten, f1 AS interval, reltime(f1) AS reltime
|
||||
FROM INTERVAL_TBL;
|
||||
ten | interval | reltime
|
||||
|
||||
@@ -27,7 +27,7 @@ INSERT INTO INET_TBL (c, i) VALUES ('192.168.1.2/24', '192.168.1.226');
|
||||
ERROR: invalid cidr value: "192.168.1.2/24"
|
||||
DETAIL: Value has bits set to right of mask.
|
||||
INSERT INTO INET_TBL (c, i) VALUES ('1234::1234::1234', '::1.2.3.4');
|
||||
ERROR: invalid input syntax for cidr: "1234::1234::1234"
|
||||
ERROR: invalid input syntax for type cidr: "1234::1234::1234"
|
||||
-- check that CIDR rejects invalid input when converting from text:
|
||||
INSERT INTO INET_TBL (c, i) VALUES (cidr('192.168.1.2/24'), '192.168.1.226');
|
||||
ERROR: invalid cidr value: "192.168.1.2/24"
|
||||
|
||||
@@ -5,8 +5,8 @@ CREATE TABLE a (aa TEXT);
|
||||
CREATE TABLE b (bb TEXT) INHERITS (a);
|
||||
CREATE TABLE c (cc TEXT) INHERITS (a);
|
||||
CREATE TABLE d (dd TEXT) INHERITS (b,c,a);
|
||||
NOTICE: merging multiple inherited definitions of attribute "aa"
|
||||
NOTICE: merging multiple inherited definitions of attribute "aa"
|
||||
NOTICE: merging multiple inherited definitions of column "aa"
|
||||
NOTICE: merging multiple inherited definitions of column "aa"
|
||||
INSERT INTO a(aa) VALUES('aaa');
|
||||
INSERT INTO a(aa) VALUES('aaaa');
|
||||
INSERT INTO a(aa) VALUES('aaaaa');
|
||||
@@ -538,7 +538,7 @@ SELECT relname, d.* FROM ONLY d, pg_class where d.tableoid = pg_class.oid;
|
||||
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"
|
||||
INSERT INTO z VALUES (NULL, 'text'); -- should fail
|
||||
ERROR: null value for attribute "aa" violates NOT NULL constraint
|
||||
ERROR: null value in column "aa" violates not-null constraint
|
||||
-- Check UPDATE with inherited target and an inherited source table
|
||||
create temp table foo(f1 int, f2 int);
|
||||
create temp table foo2(f3 int) inherits (foo);
|
||||
@@ -604,7 +604,7 @@ SELECT * FROM a; /* Has ee entry */
|
||||
(1 row)
|
||||
|
||||
CREATE TABLE inhf (LIKE inhx, LIKE inhx); /* Throw error */
|
||||
ERROR: attribute "xx" duplicated
|
||||
ERROR: column "xx" duplicated
|
||||
CREATE TABLE inhf (LIKE inhx INCLUDING DEFAULTS);
|
||||
INSERT INTO inhf DEFAULT VALUES;
|
||||
SELECT * FROM inhf; /* Single entry with value 'text' */
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
--
|
||||
create table inserttest (col1 int4, col2 int4 NOT NULL, col3 text default 'testing');
|
||||
insert into inserttest (col1, col2, col3) values (DEFAULT, DEFAULT, DEFAULT);
|
||||
ERROR: null value for attribute "col2" violates NOT NULL constraint
|
||||
ERROR: null value in column "col2" violates not-null constraint
|
||||
insert into inserttest (col2, col3) values (3, DEFAULT);
|
||||
insert into inserttest (col1, col2, col3) values (DEFAULT, 5, DEFAULT);
|
||||
insert into inserttest values (DEFAULT, 5, 'test');
|
||||
|
||||
@@ -14,7 +14,7 @@ INSERT INTO INT2_TBL(f1) VALUES ('32767');
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('-32767');
|
||||
-- bad input values -- should give warnings
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('100000');
|
||||
ERROR: 100000 is out of range for int2
|
||||
ERROR: value "100000" is out of range for type shortint
|
||||
INSERT INTO INT2_TBL(f1) VALUES ('asdf');
|
||||
ERROR: invalid input syntax for integer: "asdf"
|
||||
SELECT '' AS five, INT2_TBL.*;
|
||||
|
||||
@@ -14,7 +14,7 @@ INSERT INTO INT4_TBL(f1) VALUES ('2147483647');
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('-2147483647');
|
||||
-- bad input values -- should give warnings
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('1000000000000');
|
||||
ERROR: 1000000000000 is out of range for int4
|
||||
ERROR: value "1000000000000" is out of range for type integer
|
||||
INSERT INTO INT4_TBL(f1) VALUES ('asdf');
|
||||
ERROR: invalid input syntax for integer: "asdf"
|
||||
SELECT '' AS five, INT4_TBL.*;
|
||||
|
||||
@@ -58,9 +58,9 @@ INSERT INTO INTERVAL_TBL (f1) VALUES ('5 months');
|
||||
INSERT INTO INTERVAL_TBL (f1) VALUES ('5 months 12 hours');
|
||||
-- badly formatted interval
|
||||
INSERT INTO INTERVAL_TBL (f1) VALUES ('badly formatted interval');
|
||||
ERROR: invalid input syntax for interval: "badly formatted interval"
|
||||
ERROR: invalid input syntax for type interval: "badly formatted interval"
|
||||
INSERT INTO INTERVAL_TBL (f1) VALUES ('@ 30 eons ago');
|
||||
ERROR: invalid input syntax for interval: "@ 30 eons ago"
|
||||
ERROR: invalid input syntax for type interval: "@ 30 eons ago"
|
||||
-- test interval operators
|
||||
SELECT '' AS ten, INTERVAL_TBL.*;
|
||||
ten | f1
|
||||
|
||||
@@ -1849,7 +1849,7 @@ SELECT '' AS "xxx", *
|
||||
-- UNION JOIN isn't implemented yet
|
||||
SELECT '' AS "xxx", *
|
||||
FROM J1_TBL UNION JOIN J2_TBL;
|
||||
ERROR: UNION JOIN is not implemented yet
|
||||
ERROR: UNION JOIN is not implemented
|
||||
--
|
||||
-- Multiway full join
|
||||
--
|
||||
|
||||
@@ -11,13 +11,13 @@ INSERT INTO LSEG_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
|
||||
INSERT INTO LSEG_TBL VALUES ('(11,22,33,44)');
|
||||
-- bad values for parser testing
|
||||
INSERT INTO LSEG_TBL VALUES ('(3asdf,2 ,3,4r2)');
|
||||
ERROR: invalid input syntax for lseg: "(3asdf,2 ,3,4r2)"
|
||||
ERROR: invalid input syntax for type lseg: "(3asdf,2 ,3,4r2)"
|
||||
INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4');
|
||||
ERROR: invalid input syntax for lseg: "[1,2,3, 4"
|
||||
ERROR: invalid input syntax for type lseg: "[1,2,3, 4"
|
||||
INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]');
|
||||
ERROR: invalid input syntax for lseg: "[(,2),(3,4)]"
|
||||
ERROR: invalid input syntax for type lseg: "[(,2),(3,4)]"
|
||||
INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)');
|
||||
ERROR: invalid input syntax for lseg: "[(1,2),(3,4)"
|
||||
ERROR: invalid input syntax for type lseg: "[(1,2),(3,4)"
|
||||
select * from LSEG_TBL;
|
||||
s
|
||||
-------------------------------
|
||||
|
||||
@@ -676,12 +676,12 @@ INSERT INTO fract_only VALUES (1, '0.0');
|
||||
INSERT INTO fract_only VALUES (2, '0.1');
|
||||
INSERT INTO fract_only VALUES (3, '1.0'); -- should fail
|
||||
ERROR: numeric field overflow
|
||||
DETAIL: ABS(value) >= 10^0 for field with precision 4, scale 4.
|
||||
DETAIL: The absolute value is greater than or equal to 10^0 for field with precision 4, scale 4.
|
||||
INSERT INTO fract_only VALUES (4, '-0.9999');
|
||||
INSERT INTO fract_only VALUES (5, '0.99994');
|
||||
INSERT INTO fract_only VALUES (6, '0.99995'); -- should fail
|
||||
ERROR: numeric field overflow
|
||||
DETAIL: ABS(value) >= 10^0 for field with precision 4, scale 4.
|
||||
DETAIL: The absolute value is greater than or equal to 10^0 for field with precision 4, scale 4.
|
||||
INSERT INTO fract_only VALUES (7, '0.00001');
|
||||
INSERT INTO fract_only VALUES (8, '0.00017');
|
||||
SELECT * FROM fract_only;
|
||||
|
||||
@@ -10,9 +10,9 @@ INSERT INTO OID_TBL(f1) VALUES ('99999999');
|
||||
INSERT INTO OID_TBL(f1) VALUES ('');
|
||||
-- bad inputs
|
||||
INSERT INTO OID_TBL(f1) VALUES ('asdfasd');
|
||||
ERROR: invalid input syntax for OID: "asdfasd"
|
||||
ERROR: invalid input syntax for type "oid": "asdfasd"
|
||||
INSERT INTO OID_TBL(f1) VALUES ('99asdfasd');
|
||||
ERROR: invalid input syntax for OID: "99asdfasd"
|
||||
ERROR: invalid input syntax for type "oid": "99asdfasd"
|
||||
SELECT '' AS six, OID_TBL.*;
|
||||
six | f1
|
||||
-----+------------
|
||||
|
||||
@@ -13,9 +13,9 @@ INSERT INTO PATH_TBL VALUES ('[11,12,13,14]');
|
||||
INSERT INTO PATH_TBL VALUES ('(11,12,13,14)');
|
||||
-- bad values for parser testing
|
||||
INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
|
||||
ERROR: invalid input syntax for path: "[(,2),(3,4)]"
|
||||
ERROR: invalid input syntax for type path: "[(,2),(3,4)]"
|
||||
INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
|
||||
ERROR: invalid input syntax for path: "[(1,2),(3,4)"
|
||||
ERROR: invalid input syntax for type path: "[(1,2),(3,4)"
|
||||
SELECT f1 FROM PATH_TBL;
|
||||
f1
|
||||
---------------------------
|
||||
|
||||
@@ -1515,7 +1515,7 @@ select * from PField_v1 where pfname = 'PF0_2' order by slotname;
|
||||
-- Finally we want errors
|
||||
--
|
||||
insert into PField values ('PF1_1', 'should fail due to unique index');
|
||||
ERROR: duplicate key violates UNIQUE constraint "pfield_name"
|
||||
ERROR: duplicate key violates unique constraint "pfield_name"
|
||||
update PSlot set backlink = 'WS.not.there' where slotname = 'PS.base.a1';
|
||||
ERROR: WS.not.there does not exist
|
||||
CONTEXT: PL/pgSQL function "tg_backlink_a" line 16 at assignment
|
||||
@@ -1529,7 +1529,7 @@ update PSlot set slotlink = 'XX.illegal' where slotname = 'PS.base.a1';
|
||||
ERROR: illegal slotlink beginning with XX
|
||||
CONTEXT: PL/pgSQL function "tg_slotlink_a" line 16 at assignment
|
||||
insert into HSlot values ('HS', 'base.hub1', 1, '');
|
||||
ERROR: duplicate key violates UNIQUE constraint "hslot_name"
|
||||
ERROR: duplicate key violates unique constraint "hslot_name"
|
||||
insert into HSlot values ('HS', 'base.hub1', 20, '');
|
||||
ERROR: no manual manipulation of HSlot
|
||||
delete from HSlot;
|
||||
|
||||
@@ -9,12 +9,12 @@ INSERT INTO POINT_TBL(f1) VALUES ('(5.1, 34.5)');
|
||||
INSERT INTO POINT_TBL(f1) VALUES ('(-5.0,-12.0)');
|
||||
-- bad format points
|
||||
INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf');
|
||||
ERROR: invalid input syntax for point: "asdfasdf"
|
||||
ERROR: invalid input syntax for type point: "asdfasdf"
|
||||
INSERT INTO POINT_TBL(f1) VALUES ('10.0,10.0');
|
||||
INSERT INTO POINT_TBL(f1) VALUES ('(10.0 10.0)');
|
||||
ERROR: invalid input syntax for point: "(10.0 10.0)"
|
||||
ERROR: invalid input syntax for type point: "(10.0 10.0)"
|
||||
INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0');
|
||||
ERROR: invalid input syntax for point: "(10.0,10.0"
|
||||
ERROR: invalid input syntax for type point: "(10.0,10.0"
|
||||
SELECT '' AS six, POINT_TBL.*;
|
||||
six | f1
|
||||
-----+------------
|
||||
|
||||
@@ -21,15 +21,15 @@ INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)');
|
||||
INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)');
|
||||
-- bad polygon input strings
|
||||
INSERT INTO POLYGON_TBL(f1) VALUES ('0.0');
|
||||
ERROR: invalid input syntax for polygon: "0.0"
|
||||
ERROR: invalid input syntax for type polygon: "0.0"
|
||||
INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0');
|
||||
ERROR: invalid input syntax for polygon: "(0.0 0.0"
|
||||
ERROR: invalid input syntax for type polygon: "(0.0 0.0"
|
||||
INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)');
|
||||
ERROR: invalid input syntax for polygon: "(0,1,2)"
|
||||
ERROR: invalid input syntax for type polygon: "(0,1,2)"
|
||||
INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
|
||||
ERROR: invalid input syntax for polygon: "(0,1,2,3"
|
||||
ERROR: invalid input syntax for type polygon: "(0,1,2,3"
|
||||
INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
|
||||
ERROR: invalid input syntax for polygon: "asdf"
|
||||
ERROR: invalid input syntax for type polygon: "asdf"
|
||||
SELECT '' AS four, POLYGON_TBL.*;
|
||||
four | f1
|
||||
------+---------------------
|
||||
|
||||
@@ -76,8 +76,8 @@ CREATE AGGREGATE myaggp01a(BASETYPE = "ANY", SFUNC = stfnp, STYPE = int4[],
|
||||
-- should ERROR: stfnp(anyarray) not matched by stfnp(int[])
|
||||
CREATE AGGREGATE myaggp02a(BASETYPE = "ANY", SFUNC = stfnp, STYPE = anyarray,
|
||||
FINALFUNC = ffp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- N P
|
||||
-- should CREATE
|
||||
CREATE AGGREGATE myaggp03a(BASETYPE = "ANY", SFUNC = stfp, STYPE = int4[],
|
||||
@@ -88,12 +88,12 @@ CREATE AGGREGATE myaggp03b(BASETYPE = "ANY", SFUNC = stfp, STYPE = int4[],
|
||||
-- should ERROR: we have no way to resolve S
|
||||
CREATE AGGREGATE myaggp04a(BASETYPE = "ANY", SFUNC = stfp, STYPE = anyarray,
|
||||
FINALFUNC = ffp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggp04b(BASETYPE = "ANY", SFUNC = stfp, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- Case2 (R = P) && ((B = P) || (B = N))
|
||||
-- -------------------------------------
|
||||
-- S tf1 B tf2
|
||||
@@ -147,14 +147,14 @@ ERROR: function tfp(integer[], anyelement) does not exist
|
||||
-- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int)
|
||||
CREATE AGGREGATE myaggp13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray,
|
||||
FINALFUNC = ffp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- P N N P
|
||||
-- should ERROR: tf2p(anyarray, int) not matched by tf2p(int[],anyelement)
|
||||
CREATE AGGREGATE myaggp14a(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray,
|
||||
FINALFUNC = ffp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- P N P N
|
||||
-- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int)
|
||||
CREATE AGGREGATE myaggp15a(BASETYPE = anyelement, SFUNC = tfnp,
|
||||
@@ -169,22 +169,22 @@ ERROR: function tf2p(anyarray, anyelement) does not exist
|
||||
-- should ERROR: we have no way to resolve S
|
||||
CREATE AGGREGATE myaggp17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray,
|
||||
FINALFUNC = ffp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggp17b(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- P P N P
|
||||
-- should ERROR: tfp(anyarray, int) not matched by tfp(anyarray, anyelement)
|
||||
CREATE AGGREGATE myaggp18a(BASETYPE = int, SFUNC = tfp, STYPE = anyarray,
|
||||
FINALFUNC = ffp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggp18b(BASETYPE = int, SFUNC = tfp, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- P P P N
|
||||
-- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int)
|
||||
CREATE AGGREGATE myaggp19a(BASETYPE = anyelement, SFUNC = tf1p,
|
||||
@@ -213,12 +213,12 @@ CREATE AGGREGATE myaggn01b(BASETYPE = "ANY", SFUNC = stfnp, STYPE = int4[],
|
||||
-- should ERROR: stfnp(anyarray) not matched by stfnp(int[])
|
||||
CREATE AGGREGATE myaggn02a(BASETYPE = "ANY", SFUNC = stfnp, STYPE = anyarray,
|
||||
FINALFUNC = ffnp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggn02b(BASETYPE = "ANY", SFUNC = stfnp, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- N P
|
||||
-- should CREATE
|
||||
CREATE AGGREGATE myaggn03a(BASETYPE = "ANY", SFUNC = stfp, STYPE = int4[],
|
||||
@@ -227,8 +227,8 @@ CREATE AGGREGATE myaggn03a(BASETYPE = "ANY", SFUNC = stfp, STYPE = int4[],
|
||||
-- should ERROR: ffnp(anyarray) not matched by ffnp(int[])
|
||||
CREATE AGGREGATE myaggn04a(BASETYPE = "ANY", SFUNC = stfp, STYPE = anyarray,
|
||||
FINALFUNC = ffnp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- Case4 (R = N) && ((B = P) || (B = N))
|
||||
-- -------------------------------------
|
||||
-- S tf1 B tf2
|
||||
@@ -281,22 +281,22 @@ ERROR: function tfp(integer[], anyelement) does not exist
|
||||
-- should ERROR: tfnp(anyarray, int) not matched by tfnp(int[],int)
|
||||
CREATE AGGREGATE myaggn13a(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray,
|
||||
FINALFUNC = ffnp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggn13b(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- P N N P
|
||||
-- should ERROR: tf2p(anyarray, int) not matched by tf2p(int[],anyelement)
|
||||
CREATE AGGREGATE myaggn14a(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray,
|
||||
FINALFUNC = ffnp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggn14b(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- P N P N
|
||||
-- should ERROR: tfnp(anyarray, anyelement) not matched by tfnp(int[],int)
|
||||
CREATE AGGREGATE myaggn15a(BASETYPE = anyelement, SFUNC = tfnp,
|
||||
@@ -317,14 +317,14 @@ ERROR: function tf2p(anyarray, anyelement) does not exist
|
||||
-- should ERROR: ffnp(anyarray) not matched by ffnp(int[])
|
||||
CREATE AGGREGATE myaggn17a(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray,
|
||||
FINALFUNC = ffnp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- P P N P
|
||||
-- should ERROR: tfp(anyarray, int) not matched by tfp(anyarray, anyelement)
|
||||
CREATE AGGREGATE myaggn18a(BASETYPE = int, SFUNC = tfp, STYPE = anyarray,
|
||||
FINALFUNC = ffnp, INITCOND = '{}');
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
ERROR: cannot determine transition data type
|
||||
DETAIL: An aggregate using "anyarray" or "anyelement" as transition type must have one of them as its base type.
|
||||
-- P P P N
|
||||
-- should ERROR: tf1p(anyarray, anyelement) not matched by tf1p(anyarray, int)
|
||||
CREATE AGGREGATE myaggn19a(BASETYPE = anyelement, SFUNC = tf1p,
|
||||
|
||||
@@ -10,9 +10,9 @@ INSERT INTO RELTIME_TBL (f1) VALUES ('@ 3 months');
|
||||
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 14 seconds ago');
|
||||
-- badly formatted reltimes
|
||||
INSERT INTO RELTIME_TBL (f1) VALUES ('badly formatted reltime');
|
||||
ERROR: invalid input syntax for reltime: "badly formatted reltime"
|
||||
ERROR: invalid input syntax for type reltime: "badly formatted reltime"
|
||||
INSERT INTO RELTIME_TBL (f1) VALUES ('@ 30 eons ago');
|
||||
ERROR: invalid input syntax for reltime: "@ 30 eons ago"
|
||||
ERROR: invalid input syntax for type reltime: "@ 30 eons ago"
|
||||
-- test reltime operators
|
||||
SELECT '' AS six, RELTIME_TBL.*;
|
||||
six | f1
|
||||
|
||||
@@ -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: column "f1" does not exist
|
||||
-- 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: column "test_missing_target.b" must appear in GROUP BY clause 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
|
||||
@@ -114,7 +114,7 @@ SELECT c, count(*) FROM test_missing_target GROUP BY 1 ORDER BY 1;
|
||||
-- group using reference number out of range
|
||||
-- failure expected
|
||||
SELECT c, count(*) FROM test_missing_target GROUP BY 3;
|
||||
ERROR: GROUP BY position 3 is not in target list
|
||||
ERROR: GROUP BY position 3 is not in select list
|
||||
-- group w/o existing GROUP BY and ORDER BY target under ambiguous condition
|
||||
-- failure expected
|
||||
SELECT count(*) FROM test_missing_target x, test_missing_target y
|
||||
@@ -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: column "test_missing_target.b" must appear in GROUP BY clause 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
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
---
|
||||
|
||||
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');
|
||||
INSERT INTO serialTest VALUES ('force', 100);
|
||||
INSERT INTO serialTest VALUES ('wrong', NULL);
|
||||
ERROR: null value for attribute "f2" violates NOT NULL constraint
|
||||
ERROR: null value in column "f2" violates not-null constraint
|
||||
|
||||
SELECT * FROM serialTest;
|
||||
f1 | f2
|
||||
|
||||
@@ -81,4 +81,4 @@ SELECT * FROM temptest;
|
||||
ERROR: relation "temptest" does not exist
|
||||
-- ON COMMIT is only allowed for TEMP
|
||||
CREATE TABLE temptest(col int) ON COMMIT DELETE ROWS;
|
||||
ERROR: ON COMMIT can only be used on TEMP tables
|
||||
ERROR: ON COMMIT can only be used on temporary tables
|
||||
|
||||
@@ -11,7 +11,7 @@ CREATE TABLE TIMESTAMP_TBL ( d1 timestamp(2) without time zone);
|
||||
-- statements.
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('now');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('current');
|
||||
ERROR: "current" is no longer supported
|
||||
ERROR: date/time value "current" is no longer supported
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('today');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('yesterday');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('tomorrow');
|
||||
@@ -60,13 +60,13 @@ INSERT INTO TIMESTAMP_TBL VALUES ('infinity');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('epoch');
|
||||
-- Obsolete special values
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('invalid');
|
||||
ERROR: "invalid" is no longer supported
|
||||
ERROR: date/time value "invalid" is no longer supported
|
||||
-- Postgres v6.0 standard output format
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Invalid Abstime');
|
||||
ERROR: "Invalid Abstime" is no longer supported
|
||||
ERROR: date/time value "Invalid Abstime" is no longer supported
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Undefined Abstime');
|
||||
ERROR: "Undefined Abstime" is no longer supported
|
||||
ERROR: date/time value "Undefined Abstime" is no longer supported
|
||||
-- Variations on Postgres v6.1 standard output format
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01.000001 1997 PST');
|
||||
INSERT INTO TIMESTAMP_TBL VALUES ('Mon Feb 10 17:32:01.999999 1997 PST');
|
||||
|
||||
@@ -6,7 +6,7 @@ SET australian_timezones = 'off';
|
||||
CREATE TABLE TIMESTAMPTZ_TBL ( d1 timestamp(2) with time zone);
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('now');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('current');
|
||||
ERROR: "current" is no longer supported
|
||||
ERROR: date/time value "current" is no longer supported
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('today');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('yesterday');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('tomorrow');
|
||||
@@ -55,13 +55,13 @@ INSERT INTO TIMESTAMPTZ_TBL VALUES ('infinity');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('epoch');
|
||||
-- Obsolete special values
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('invalid');
|
||||
ERROR: "invalid" is no longer supported
|
||||
ERROR: date/time value "invalid" is no longer supported
|
||||
-- Postgres v6.0 standard output format
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01 1997 PST');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Invalid Abstime');
|
||||
ERROR: "Invalid Abstime" is no longer supported
|
||||
ERROR: date/time value "Invalid Abstime" is no longer supported
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Undefined Abstime');
|
||||
ERROR: "Undefined Abstime" is no longer supported
|
||||
ERROR: date/time value "Undefined Abstime" is no longer supported
|
||||
-- Variations on Postgres v6.1 standard output format
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01.000001 1997 PST');
|
||||
INSERT INTO TIMESTAMPTZ_TBL VALUES ('Mon Feb 10 17:32:01.999999 1997 PST');
|
||||
|
||||
@@ -17,10 +17,10 @@ INSERT INTO TINTERVAL_TBL (f1)
|
||||
-- badly formatted tintervals
|
||||
INSERT INTO TINTERVAL_TBL (f1)
|
||||
VALUES ('["bad time specifications" ""]');
|
||||
ERROR: invalid input syntax for abstime: "bad time specifications"
|
||||
ERROR: invalid input syntax for type abstime: "bad time specifications"
|
||||
INSERT INTO TINTERVAL_TBL (f1)
|
||||
VALUES ('["" "infinity"]');
|
||||
ERROR: invalid input syntax for abstime: ""
|
||||
ERROR: invalid input syntax for type abstime: ""
|
||||
-- test tinterval operators
|
||||
SELECT '' AS five, TINTERVAL_TBL.*;
|
||||
five | f1
|
||||
|
||||
@@ -32,7 +32,7 @@ SELECT * FROM truncate_a;
|
||||
|
||||
-- Test foreign constraint check
|
||||
CREATE TABLE truncate_b(col1 integer references truncate_a);
|
||||
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
NOTICE: CREATE TABLE will create implicit triggers for foreign-key checks
|
||||
INSERT INTO truncate_a VALUES (1);
|
||||
SELECT * FROM truncate_a;
|
||||
col1
|
||||
|
||||
@@ -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: column "q2" does not exist
|
||||
-- But this should work:
|
||||
SELECT q1 FROM int8_tbl EXCEPT (((SELECT q2 FROM int8_tbl ORDER BY q2 LIMIT 1)));
|
||||
q1
|
||||
|
||||
Reference in New Issue
Block a user