mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Use format_type sibling in backend error messages, so the user sees
consistent type naming.
This commit is contained in:
@ -322,13 +322,13 @@ CREATE TEMP TABLE FKTABLE (ftest1 text);
|
||||
-- This next should fail, because text=int does not exist
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable;
|
||||
NOTICE: ALTER TABLE ... ADD CONSTRAINT 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
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
|
||||
NOTICE: ALTER TABLE ... ADD CONSTRAINT 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
|
||||
@ -350,7 +350,7 @@ NOTICE: CREATE TABLE/PRIMARY KEY will create implicit index 'pktable_pkey' for
|
||||
CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime);
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2) references pktable;
|
||||
NOTICE: ALTER TABLE ... ADD CONSTRAINT 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...
|
||||
DROP TABLE FKTABLE;
|
||||
@ -358,7 +358,7 @@ CREATE TEMP TABLE FKTABLE (ftest1 cidr, ftest2 datetime);
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
|
||||
references pktable(ptest1, ptest2);
|
||||
NOTICE: ALTER TABLE ... ADD CONSTRAINT 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
|
||||
DROP TABLE FKTABLE;
|
||||
@ -366,13 +366,13 @@ CREATE TEMP TABLE FKTABLE (ftest1 int, ftest2 text);
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1, ftest2)
|
||||
references pktable(ptest2, ptest1);
|
||||
NOTICE: ALTER TABLE ... ADD CONSTRAINT 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
|
||||
-- As does this...
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest2, ftest1)
|
||||
references pktable(ptest1, ptest2);
|
||||
NOTICE: ALTER TABLE ... ADD CONSTRAINT 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
|
||||
-- temp tables should go away by themselves, need not drop them.
|
||||
-- test check constraint adding
|
||||
|
@ -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
|
||||
|
@ -43,7 +43,7 @@ SELECT date '1991-02-03' - time '04:05:06' AS "Subtract Time";
|
||||
(1 row)
|
||||
|
||||
SELECT date '1991-02-03' - time with time zone '04:05:06 UTC' AS "Subtract Time UTC";
|
||||
ERROR: Unable to identify an operator '-' for types 'date' and 'timetz'
|
||||
ERROR: Unable to identify an operator '-' for types 'date' and 'time with time zone'
|
||||
You will have to retype this query using an explicit cast
|
||||
--
|
||||
-- timestamp, interval arithmetic
|
||||
@ -118,9 +118,9 @@ SELECT interval '04:30' - time '01:02' AS "+03:28";
|
||||
(1 row)
|
||||
|
||||
SELECT CAST(time with time zone '01:02-08' AS interval) AS "+00:01";
|
||||
ERROR: Cannot cast type 'timetz' to 'interval'
|
||||
ERROR: Cannot cast type time with time zone to interval
|
||||
SELECT CAST(interval '02:03' AS time with time zone) AS "02:03:00-08";
|
||||
ERROR: Cannot cast type 'interval' to 'timetz'
|
||||
ERROR: Cannot cast type interval to time with time zone
|
||||
SELECT time with time zone '01:30-08' - interval '02:01' AS "23:29:00-08";
|
||||
23:29:00-08
|
||||
-------------
|
||||
@ -153,7 +153,7 @@ SELECT CAST(date 'today' + time with time zone '03:30'
|
||||
(1 row)
|
||||
|
||||
SELECT interval '04:30' - time with time zone '01:02' AS "+03:28";
|
||||
ERROR: Unable to identify an operator '-' for types 'interval' and 'timetz'
|
||||
ERROR: Unable to identify an operator '-' for types 'interval' and 'time with time zone'
|
||||
You will have to retype this query using an explicit cast
|
||||
-- We get 100 rows when run in GMT...
|
||||
SELECT t.d1 + i.f1 AS "102" FROM TIMESTAMP_TBL t, INTERVAL_TBL i
|
||||
|
@ -71,5 +71,5 @@ SELECT f1 + time '00:01' AS "Illegal" FROM TIME_TBL;
|
||||
ERROR: Unable to identify an operator '+' for types 'time' and 'time'
|
||||
You will have to retype this query using an explicit cast
|
||||
SELECT f2 + time with time zone '00:01' AS "Illegal" FROM TIME_TBL;
|
||||
ERROR: Unable to identify an operator '+' for types 'timetz' and 'timetz'
|
||||
ERROR: Unable to identify an operator '+' for types 'time with time zone' and 'time with time zone'
|
||||
You will have to retype this query using an explicit cast
|
||||
|
Reference in New Issue
Block a user