|
|
|
@ -721,13 +721,13 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for |
|
|
|
|
-- This next should fail, because text=int does not exist |
|
|
|
|
CREATE TABLE FKTABLE (ftest1 text REFERENCES pktable); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- This should also fail for the same reason, but here we |
|
|
|
|
-- give the column name |
|
|
|
|
CREATE TABLE FKTABLE (ftest1 text REFERENCES pktable(ptest1)); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- This should succeed, even though they are different types |
|
|
|
|
-- because varchar=int does exist |
|
|
|
@ -749,27 +749,27 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for |
|
|
|
|
-- This should fail, because we just chose really odd types |
|
|
|
|
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 datetime, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- Again, so should this... |
|
|
|
|
CREATE TABLE FKTABLE (ftest1 cidr, ftest2 datetime, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest1, ptest2)); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- This fails because we mixed up the column ordering |
|
|
|
|
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- As does this... |
|
|
|
|
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest1, ptest2)); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- And again.. |
|
|
|
|
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest1, ftest2) REFERENCES pktable(ptest2, ptest1)); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'int4' and 'text' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'integer' and 'text' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- This works... |
|
|
|
|
CREATE TABLE FKTABLE (ftest1 int, ftest2 text, FOREIGN KEY(ftest2, ftest1) REFERENCES pktable(ptest2, ptest1)); |
|
|
|
@ -802,21 +802,21 @@ CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, PRIMARY |
|
|
|
|
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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'int4' and 'text' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'integer' and 'text' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- Nor should this... (same reason, we have 4,3 referencing 1,2 which mismatches types |
|
|
|
|
CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, 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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- Not this one either... Same as the last one except we didn't defined the columns being referenced. |
|
|
|
|
CREATE TABLE PKTABLE (ptest1 int, ptest2 text, ptest3 int, ptest4 text, 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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- |
|
|
|
|
-- Now some cases with inheritance |
|
|
|
@ -912,24 +912,24 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for |
|
|
|
|
-- 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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'cidr' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'cidr' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
-- let's mix up which columns reference which |
|
|
|
|
create table fktable(ftest1 int, ftest2 text, foreign key(ftest2, ftest1) references pktable); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
create table fktable(ftest1 int, ftest2 text, foreign key(ftest2, ftest1) references pktable(base1, ptest1)); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
create table fktable(ftest1 int, ftest2 text, foreign key(ftest1, ftest2) references pktable(ptest1, base1)); |
|
|
|
|
NOTICE: CREATE TABLE will create implicit trigger(s) for FOREIGN KEY check(s) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'int4' and 'text' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'integer' and 'text' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
drop table pktable; |
|
|
|
|
drop table pktable_base; |
|
|
|
@ -939,25 +939,25 @@ create table pktable(ptest1 text, ptest2 text[], primary key(base1, ptest1), for |
|
|
|
|
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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types '_text' and 'text' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text[]' and 'text' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
create table pktable(ptest1 text, ptest2 text, 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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'int4' and 'text' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'integer' and 'text' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
create table pktable(ptest1 text, ptest2 text, 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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
create table pktable(ptest1 text, ptest2 text, 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) |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'int4' |
|
|
|
|
ERROR: Unable to identify an operator '=' for types 'text' and 'integer' |
|
|
|
|
You will have to retype this query using an explicit cast |
|
|
|
|
drop table pktable; |
|
|
|
|
ERROR: table "pktable" does not exist |
|
|
|
|