1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Message improvements

This commit is contained in:
Peter Eisentraut
2015-11-16 21:16:42 -05:00
parent 53264c7b1e
commit 5db837d3f2
26 changed files with 78 additions and 82 deletions

View File

@ -551,7 +551,7 @@ create table atacc1 ( test int );
-- add a check constraint (fails)
alter table atacc1 add constraint atacc_test1 check (test1>3);
ERROR: column "test1" does not exist
HINT: Perhaps you meant to reference the column "atacc1"."test".
HINT: Perhaps you meant to reference the column "atacc1.test".
drop table atacc1;
-- something a little more complicated
create table atacc1 ( test int, test2 int, test3 int);
@ -1358,7 +1358,7 @@ select f1 from c1;
ERROR: column "f1" does not exist
LINE 1: select f1 from c1;
^
HINT: Perhaps you meant to reference the column "c1"."f2".
HINT: Perhaps you meant to reference the column "c1.f2".
drop table p1 cascade;
NOTICE: drop cascades to table c1
create table p1 (f1 int, f2 int);
@ -1372,7 +1372,7 @@ select f1 from c1;
ERROR: column "f1" does not exist
LINE 1: select f1 from c1;
^
HINT: Perhaps you meant to reference the column "c1"."f2".
HINT: Perhaps you meant to reference the column "c1.f2".
drop table p1 cascade;
NOTICE: drop cascades to table c1
create table p1 (f1 int, f2 int);
@ -2601,8 +2601,7 @@ CREATE UNLOGGED TABLE unlogged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unl
CREATE UNLOGGED TABLE unlogged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged3); -- self-referencing foreign key
ALTER TABLE unlogged3 SET LOGGED; -- skip self-referencing foreign key
ALTER TABLE unlogged2 SET LOGGED; -- fails because a foreign key to an unlogged table exists
ERROR: cannot change status of table unlogged2 to logged
DETAIL: Table unlogged2 references unlogged table unlogged1.
ERROR: could not change table "unlogged2" to logged because it references unlogged table "unlogged1"
ALTER TABLE unlogged1 SET LOGGED;
-- check relpersistence of an unlogged table after changing to permament
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1'
@ -2645,8 +2644,7 @@ ORDER BY relname;
CREATE TABLE logged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES logged1); -- foreign key
CREATE TABLE logged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES logged3); -- self-referencing foreign key
ALTER TABLE logged1 SET UNLOGGED; -- fails because a foreign key from a permanent table exists
ERROR: cannot change status of table logged1 to unlogged
DETAIL: Logged table logged2 is referenced by table logged1.
ERROR: could not change table "logged1" to unlogged because it references logged table "logged2"
ALTER TABLE logged3 SET UNLOGGED; -- skip self-referencing foreign key
ALTER TABLE logged2 SET UNLOGGED;
ALTER TABLE logged1 SET UNLOGGED;

View File

@ -226,7 +226,7 @@ insert into insertconflicttest values (1, 'Apple') on conflict do update set fru
ERROR: ON CONFLICT DO UPDATE requires inference specification or constraint name
LINE 1: ...nsert into insertconflicttest values (1, 'Apple') on conflic...
^
HINT: For example, ON CONFLICT (<column>).
HINT: For example, ON CONFLICT (column_name).
-- inference succeeds:
insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruit;
insert into insertconflicttest values (2, 'Orange') on conflict (key, key, key) do update set fruit = excluded.fruit;
@ -246,13 +246,13 @@ insert into insertconflicttest values (1, 'Apple') on conflict (keyy) do update
ERROR: column "keyy" does not exist
LINE 1: ...nsertconflicttest values (1, 'Apple') on conflict (keyy) do ...
^
HINT: Perhaps you meant to reference the column "insertconflicttest"."key".
HINT: Perhaps you meant to reference the column "insertconflicttest.key".
-- Have useful HINT for EXCLUDED.* RTE within UPDATE:
insert into insertconflicttest values (1, 'Apple') on conflict (key) do update set fruit = excluded.fruitt;
ERROR: column excluded.fruitt does not exist
LINE 1: ... 'Apple') on conflict (key) do update set fruit = excluded.f...
^
HINT: Perhaps you meant to reference the column "excluded"."fruit".
HINT: Perhaps you meant to reference the column "excluded.fruit".
-- inference fails:
insert into insertconflicttest values (3, 'Kiwi') on conflict (key, fruit) do update set fruit = excluded.fruit;
ERROR: there is no unique or exclusion constraint matching the ON CONFLICT specification

View File

@ -2299,7 +2299,7 @@ select t1.x from t1 join t3 on (t1.a = t3.x);
ERROR: column t1.x does not exist
LINE 1: select t1.x from t1 join t3 on (t1.a = t3.x);
^
HINT: Perhaps you meant to reference the column "t3"."x".
HINT: Perhaps you meant to reference the column "t3.x".
--
-- regression test for 8.1 merge right join bug
--
@ -3982,19 +3982,19 @@ select t1.uunique1 from
ERROR: column t1.uunique1 does not exist
LINE 1: select t1.uunique1 from
^
HINT: Perhaps you meant to reference the column "t1"."unique1".
HINT: Perhaps you meant to reference the column "t1.unique1".
select t2.uunique1 from
tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, prefer "t2" suggestion
ERROR: column t2.uunique1 does not exist
LINE 1: select t2.uunique1 from
^
HINT: Perhaps you meant to reference the column "t2"."unique1".
HINT: Perhaps you meant to reference the column "t2.unique1".
select uunique1 from
tenk1 t1 join tenk2 t2 on t1.two = t2.two; -- error, suggest both at once
ERROR: column "uunique1" does not exist
LINE 1: select uunique1 from
^
HINT: Perhaps you meant to reference the column "t1"."unique1" or the column "t2"."unique1".
HINT: Perhaps you meant to reference the column "t1.unique1" or the column "t2.unique1".
--
-- Take care to reference the correct RTE
--

View File

@ -1373,7 +1373,7 @@ SELECT jsonb_build_object(1,2);
-- keys must be scalar and not null
SELECT jsonb_build_object(null,2);
ERROR: arg 1: key cannot be null
ERROR: argument 1: key must not be null
SELECT jsonb_build_object(r,2) FROM (SELECT 1 AS a, 2 AS b) r;
ERROR: key value must be scalar, not array, composite, or json
SELECT jsonb_build_object(json '{"a":1,"b":2}', 3);

View File

@ -253,11 +253,11 @@ WARNING: error for policy,{addr_nsp,zwei},{integer}: relation "addr_nsp" does n
WARNING: error for policy,{eins,zwei,drei},{}: schema "eins" does not exist
WARNING: error for policy,{eins,zwei,drei},{integer}: schema "eins" does not exist
WARNING: error for user mapping,{eins},{}: argument list length must be exactly 1
WARNING: error for user mapping,{eins},{integer}: user mapping for user "eins" in server "integer" does not exist
WARNING: error for user mapping,{eins},{integer}: user mapping for user "eins" on server "integer" does not exist
WARNING: error for user mapping,{addr_nsp,zwei},{}: argument list length must be exactly 1
WARNING: error for user mapping,{addr_nsp,zwei},{integer}: user mapping for user "addr_nsp" in server "integer" does not exist
WARNING: error for user mapping,{addr_nsp,zwei},{integer}: user mapping for user "addr_nsp" on server "integer" does not exist
WARNING: error for user mapping,{eins,zwei,drei},{}: argument list length must be exactly 1
WARNING: error for user mapping,{eins,zwei,drei},{integer}: user mapping for user "eins" in server "integer" does not exist
WARNING: error for user mapping,{eins,zwei,drei},{integer}: user mapping for user "eins" on server "integer" does not exist
WARNING: error for default acl,{eins},{}: argument list length must be exactly 1
WARNING: error for default acl,{eins},{integer}: unrecognized default ACL object type i
WARNING: error for default acl,{addr_nsp,zwei},{}: argument list length must be exactly 1

View File

@ -2577,7 +2577,7 @@ COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ',';
SET SESSION AUTHORIZATION rls_regress_user1;
SET row_security TO OFF;
COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls
ERROR: insufficient privilege to bypass row security.
ERROR: insufficient privilege to bypass row-level security
SET row_security TO ON;
COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --ok
0,cfcd208495d565ef66e7dff9f98764da
@ -2618,7 +2618,7 @@ COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --ok
SET SESSION AUTHORIZATION rls_regress_user2;
SET row_security TO OFF;
COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls
ERROR: insufficient privilege to bypass row security.
ERROR: insufficient privilege to bypass row-level security
SET row_security TO ON;
COPY (SELECT * FROM copy_t ORDER BY a ASC) TO STDOUT WITH DELIMITER ','; --fail - permission denied
ERROR: permission denied for relation copy_t
@ -2642,7 +2642,7 @@ COPY copy_rel_to TO STDOUT WITH DELIMITER ',';
SET SESSION AUTHORIZATION rls_regress_user1;
SET row_security TO OFF;
COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --fail - insufficient to bypass rls
ERROR: insufficient privilege to bypass row security.
ERROR: insufficient privilege to bypass row-level security
SET row_security TO ON;
COPY copy_rel_to TO STDOUT WITH DELIMITER ','; --ok
-- Check COPY TO as user with permissions and BYPASSRLS
@ -2671,10 +2671,10 @@ COPY copy_t FROM STDIN; --ok
SET SESSION AUTHORIZATION rls_regress_user1;
SET row_security TO OFF;
COPY copy_t FROM STDIN; --fail - insufficient privilege to bypass rls.
ERROR: insufficient privilege to bypass row security.
ERROR: insufficient privilege to bypass row-level security
SET row_security TO ON;
COPY copy_t FROM STDIN; --fail - COPY FROM not supported by RLS.
ERROR: COPY FROM not supported with row level security.
ERROR: COPY FROM not supported with row-level security.
HINT: Use INSERT statements instead.
-- Check COPY FROM as user with permissions and BYPASSRLS
SET SESSION AUTHORIZATION rls_regress_exempt_user;