mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
Error message editing in backend/catalog.
This commit is contained in:
@@ -358,8 +358,8 @@ NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
ALTER TABLE FKTABLE ADD FOREIGN KEY(ftest1) references pktable(ptest1);
|
||||
NOTICE: ALTER TABLE will create implicit trigger(s) for FOREIGN KEY check(s)
|
||||
DROP TABLE pktable cascade;
|
||||
NOTICE: Drop cascades to constraint $2 on table fktable
|
||||
NOTICE: Drop cascades to constraint $1 on table fktable
|
||||
NOTICE: drop cascades to constraint $2 on table fktable
|
||||
NOTICE: drop cascades to constraint $1 on table fktable
|
||||
DROP TABLE fktable;
|
||||
CREATE TEMP TABLE PKTABLE (ptest1 int, ptest2 inet,
|
||||
PRIMARY KEY(ptest1, ptest2));
|
||||
@@ -619,9 +619,9 @@ alter table pg_class alter relname set not null;
|
||||
ERROR: "pg_class" is a system catalog
|
||||
-- try altering non-existent table, should fail
|
||||
alter table non_existent alter column bar set not null;
|
||||
ERROR: Relation "non_existent" does not exist
|
||||
ERROR: relation "non_existent" does not exist
|
||||
alter table non_existent alter column bar drop not null;
|
||||
ERROR: Relation "non_existent" does not exist
|
||||
ERROR: relation "non_existent" does not exist
|
||||
-- test setting columns to null and not null and vice versa
|
||||
-- test checking for null values and primary key
|
||||
create table atacc1 (test int not null);
|
||||
@@ -744,7 +744,7 @@ alter table pg_class drop column relname;
|
||||
ERROR: "pg_class" is a system catalog
|
||||
-- try altering non-existent table, should fail
|
||||
alter table foo drop column bar;
|
||||
ERROR: Relation "foo" does not exist
|
||||
ERROR: relation "foo" does not exist
|
||||
-- test dropping columns
|
||||
create table atacc1 (a int4 not null, b int4, c int4 not null, d int4);
|
||||
insert into atacc1 values (1, 2, 3, 4);
|
||||
@@ -1074,7 +1074,7 @@ alter table c1 drop column f1;
|
||||
select f1 from c1;
|
||||
ERROR: attribute "f1" not found
|
||||
drop table p1 cascade;
|
||||
NOTICE: Drop cascades to table c1
|
||||
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
|
||||
@@ -1085,7 +1085,7 @@ alter table p1 drop column f1;
|
||||
select f1 from c1;
|
||||
ERROR: attribute "f1" not found
|
||||
drop table p1 cascade;
|
||||
NOTICE: Drop cascades to table c1
|
||||
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
|
||||
@@ -1095,7 +1095,7 @@ 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;
|
||||
drop table p1 cascade;
|
||||
NOTICE: Drop cascades to table c1
|
||||
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
|
||||
@@ -1106,7 +1106,7 @@ alter table only p1 drop column f1;
|
||||
-- c1.f1 is still there, but no longer inherited
|
||||
alter table c1 drop column f1;
|
||||
drop table p1 cascade;
|
||||
NOTICE: Drop cascades to table c1
|
||||
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);
|
||||
@@ -1166,8 +1166,8 @@ order by relname, attnum;
|
||||
(8 rows)
|
||||
|
||||
drop table p1, p2 cascade;
|
||||
NOTICE: Drop cascades to table c1
|
||||
NOTICE: Drop cascades to table gc1
|
||||
NOTICE: drop cascades to table c1
|
||||
NOTICE: drop cascades to table gc1
|
||||
--
|
||||
-- Test the ALTER TABLE WITHOUT OIDS command
|
||||
--
|
||||
@@ -1250,8 +1250,8 @@ select * from p1;
|
||||
(2 rows)
|
||||
|
||||
drop table p1 cascade;
|
||||
NOTICE: Drop cascades to table c1
|
||||
NOTICE: Drop cascades to constraint p1_a1 on table c1
|
||||
NOTICE: drop cascades to table c1
|
||||
NOTICE: drop cascades to constraint p1_a1 on table c1
|
||||
-- test that operations with a dropped column do not try to reference
|
||||
-- its datatype
|
||||
create domain mytype as text;
|
||||
@@ -1264,7 +1264,7 @@ select * from foo;
|
||||
(1 row)
|
||||
|
||||
drop domain mytype cascade;
|
||||
NOTICE: Drop cascades to table foo column f2
|
||||
NOTICE: drop cascades to table foo column f2
|
||||
select * from foo;
|
||||
f1 | f3
|
||||
----+----
|
||||
|
||||
@@ -8,7 +8,7 @@ CREATE CONVERSION myconv FOR 'LATIN1' TO 'UNICODE' FROM iso8859_1_to_utf8;
|
||||
-- cannot make same name conversion in same schema
|
||||
--
|
||||
CREATE CONVERSION myconv FOR 'LATIN1' TO 'UNICODE' FROM iso8859_1_to_utf8;
|
||||
ERROR: conversion name "myconv" already exists
|
||||
ERROR: conversion "myconv" already exists
|
||||
--
|
||||
-- create default conversion with qualified name
|
||||
--
|
||||
@@ -17,7 +17,7 @@ CREATE DEFAULT CONVERSION public.mydef FOR 'LATIN1' TO 'UNICODE' FROM iso8859_1_
|
||||
-- cannot make default conversion with same shcema/for_encoding/to_encoding
|
||||
--
|
||||
CREATE DEFAULT CONVERSION public.mydef2 FOR 'LATIN1' TO 'UNICODE' FROM iso8859_1_to_utf8;
|
||||
ERROR: default conversion for LATIN1 to UNICODE already exists
|
||||
ERROR: default conversion for "LATIN1" to "UNICODE" already exists
|
||||
--
|
||||
-- drop user defined conversion
|
||||
--
|
||||
|
||||
@@ -72,5 +72,5 @@ SELECT * FROM get_default_test();
|
||||
(1 row)
|
||||
|
||||
DROP TYPE default_test_row CASCADE;
|
||||
NOTICE: Drop cascades to function get_default_test()
|
||||
NOTICE: drop cascades to function get_default_test()
|
||||
DROP TABLE default_test;
|
||||
|
||||
@@ -214,8 +214,8 @@ alter domain dnotnulltest drop not null; -- fails
|
||||
NOTICE: "dnotnulltest" is already set to NULL
|
||||
update domnotnull set col1 = null;
|
||||
drop domain dnotnulltest cascade;
|
||||
NOTICE: Drop cascades to table domnotnull column col2
|
||||
NOTICE: Drop cascades to table domnotnull column col1
|
||||
NOTICE: drop cascades to table domnotnull column col2
|
||||
NOTICE: drop cascades to table domnotnull column col1
|
||||
-- Test ALTER DOMAIN .. DEFAULT ..
|
||||
create table domdeftest (col1 ddef1);
|
||||
insert into domdeftest default values;
|
||||
|
||||
@@ -25,7 +25,7 @@ select;
|
||||
ERROR: syntax error at or near ";" at character 7
|
||||
-- no such relation
|
||||
select * from nonesuch;
|
||||
ERROR: Relation "nonesuch" does not exist
|
||||
ERROR: relation "nonesuch" does not exist
|
||||
-- missing target list
|
||||
select from pg_database;
|
||||
ERROR: syntax error at or near "from" at character 8
|
||||
@@ -52,7 +52,7 @@ delete from;
|
||||
ERROR: syntax error at or near ";" at character 12
|
||||
-- no such relation
|
||||
delete from nonesuch;
|
||||
ERROR: Relation "nonesuch" does not exist
|
||||
ERROR: relation "nonesuch" does not exist
|
||||
--
|
||||
-- DROP
|
||||
|
||||
@@ -71,10 +71,10 @@ alter table rename;
|
||||
ERROR: syntax error at or near ";" at character 19
|
||||
-- no such relation
|
||||
alter table nonesuch rename to newnonesuch;
|
||||
ERROR: Relation "nonesuch" does not exist
|
||||
ERROR: relation "nonesuch" does not exist
|
||||
-- no such relation
|
||||
alter table nonesuch rename to stud_emp;
|
||||
ERROR: Relation "nonesuch" does not exist
|
||||
ERROR: relation "nonesuch" does not exist
|
||||
-- conflict
|
||||
alter table stud_emp rename to aggtest;
|
||||
ERROR: relation "aggtest" already exists
|
||||
@@ -84,7 +84,7 @@ ERROR: relation "stud_emp" already exists
|
||||
-- attribute renaming
|
||||
-- no such relation
|
||||
alter table nonesuchrel rename column nonesuchatt to newnonesuchatt;
|
||||
ERROR: Relation "nonesuchrel" does not exist
|
||||
ERROR: relation "nonesuchrel" does not exist
|
||||
-- no such attribute
|
||||
alter table emp rename column nonesuchatt to newnonesuchatt;
|
||||
ERROR: attribute "nonesuchatt" does not exist
|
||||
@@ -227,7 +227,7 @@ drop rule 314159;
|
||||
ERROR: syntax error at or near "314159" at character 11
|
||||
-- no such rule
|
||||
drop rule nonesuch on noplace;
|
||||
ERROR: Relation "noplace" does not exist
|
||||
ERROR: relation "noplace" does not exist
|
||||
-- bad keyword
|
||||
drop tuple rule nonesuch;
|
||||
ERROR: syntax error at or near "tuple" at character 6
|
||||
|
||||
@@ -138,7 +138,7 @@ SELECT * FROM FKTABLE;
|
||||
(5 rows)
|
||||
|
||||
DROP TABLE PKTABLE CASCADE;
|
||||
NOTICE: Drop cascades to constraint constrname on table fktable
|
||||
NOTICE: drop cascades to constraint constrname on table fktable
|
||||
DROP TABLE FKTABLE;
|
||||
--
|
||||
-- check set default and table constraint on multiple columns
|
||||
@@ -225,10 +225,10 @@ SELECT * FROM FKTABLE;
|
||||
-- this should fail for lack of CASCADE
|
||||
DROP TABLE PKTABLE;
|
||||
NOTICE: constraint constrname2 on table fktable depends on table pktable
|
||||
ERROR: Cannot drop table pktable because other objects depend on it
|
||||
Use DROP ... CASCADE to drop the dependent objects too
|
||||
ERROR: cannot drop table pktable because other objects depend on it
|
||||
HINT: Use DROP ... CASCADE to drop the dependent objects too.
|
||||
DROP TABLE PKTABLE CASCADE;
|
||||
NOTICE: Drop cascades to constraint constrname2 on table fktable
|
||||
NOTICE: drop cascades to constraint constrname2 on table fktable
|
||||
DROP TABLE FKTABLE;
|
||||
--
|
||||
-- First test, check with no on delete or on update
|
||||
|
||||
@@ -76,7 +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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
-- N P
|
||||
-- should CREATE
|
||||
CREATE AGGREGATE myaggp03a(BASETYPE = "ANY", SFUNC = stfp, STYPE = int4[],
|
||||
@@ -87,10 +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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggp04b(BASETYPE = "ANY", SFUNC = stfp, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
-- Case2 (R = P) && ((B = P) || (B = N))
|
||||
-- -------------------------------------
|
||||
-- S tf1 B tf2
|
||||
@@ -144,12 +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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans 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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans 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,
|
||||
@@ -164,18 +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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggp17b(BASETYPE = int, SFUNC = tf1p, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans 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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggp18b(BASETYPE = int, SFUNC = tfp, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans 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,
|
||||
@@ -204,10 +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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggn02b(BASETYPE = "ANY", SFUNC = stfnp, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
-- N P
|
||||
-- should CREATE
|
||||
CREATE AGGREGATE myaggn03a(BASETYPE = "ANY", SFUNC = stfp, STYPE = int4[],
|
||||
@@ -216,7 +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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
-- Case4 (R = N) && ((B = P) || (B = N))
|
||||
-- -------------------------------------
|
||||
-- S tf1 B tf2
|
||||
@@ -269,18 +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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggn13b(BASETYPE = int, SFUNC = tfnp, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans 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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans type must have one of them as its base type.
|
||||
CREATE AGGREGATE myaggn14b(BASETYPE = int, SFUNC = tf2p, STYPE = anyarray,
|
||||
INITCOND = '{}');
|
||||
ERROR: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans 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,
|
||||
@@ -301,12 +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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans 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: an aggregate using ANYARRAY or ANYELEMENT as trans type must also have one of them as its base type
|
||||
ERROR: cannot determine transition datatype
|
||||
DETAIL: An aggregate using ANYARRAY or ANYELEMENT as trans 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,
|
||||
|
||||
@@ -69,11 +69,11 @@ SELECT * FROM atest2; -- ok
|
||||
|
||||
INSERT INTO atest1 VALUES (2, 'two'); -- ok
|
||||
INSERT INTO atest2 VALUES ('foo', true); -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
INSERT INTO atest1 SELECT 1, b FROM atest1; -- ok
|
||||
UPDATE atest1 SET a = 1 WHERE a = 2; -- ok
|
||||
UPDATE atest2 SET col2 = NOT col2; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
SELECT * FROM atest1 FOR UPDATE; -- ok
|
||||
a | b
|
||||
---+-----
|
||||
@@ -82,15 +82,15 @@ SELECT * FROM atest1 FOR UPDATE; -- ok
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM atest2 FOR UPDATE; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
DELETE FROM atest2; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
COPY atest2 FROM stdin; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
GRANT ALL ON atest1 TO PUBLIC; -- fail
|
||||
ERROR: atest1: permission denied
|
||||
ERROR: permission denied for "atest1"
|
||||
-- checks in subquery, both ok
|
||||
SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) );
|
||||
a | b
|
||||
@@ -117,33 +117,33 @@ SELECT * FROM atest1; -- ok
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM atest2; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
INSERT INTO atest1 VALUES (2, 'two'); -- fail
|
||||
ERROR: atest1: permission denied
|
||||
ERROR: permission denied for "atest1"
|
||||
INSERT INTO atest2 VALUES ('foo', true); -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
INSERT INTO atest1 SELECT 1, b FROM atest1; -- fail
|
||||
ERROR: atest1: permission denied
|
||||
ERROR: permission denied for "atest1"
|
||||
UPDATE atest1 SET a = 1 WHERE a = 2; -- fail
|
||||
ERROR: atest1: permission denied
|
||||
ERROR: permission denied for "atest1"
|
||||
UPDATE atest2 SET col2 = NULL; -- ok
|
||||
UPDATE atest2 SET col2 = NOT col2; -- fails; requires SELECT on atest2
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
UPDATE atest2 SET col2 = true WHERE atest1.a = 5; -- ok
|
||||
SELECT * FROM atest1 FOR UPDATE; -- fail
|
||||
ERROR: atest1: permission denied
|
||||
ERROR: permission denied for "atest1"
|
||||
SELECT * FROM atest2 FOR UPDATE; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
DELETE FROM atest2; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
LOCK atest2 IN ACCESS EXCLUSIVE MODE; -- ok
|
||||
COPY atest2 FROM stdin; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
-- checks in subquery, both fail
|
||||
SELECT * FROM atest1 WHERE ( b IN ( SELECT col1 FROM atest2 ) );
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
SELECT * FROM atest2 WHERE ( col1 IN ( SELECT b FROM atest1 ) );
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
SET SESSION AUTHORIZATION regressuser4;
|
||||
COPY atest2 FROM stdin; -- ok
|
||||
SELECT * FROM atest1; -- ok
|
||||
@@ -159,7 +159,7 @@ CREATE TABLE atest3 (one int, two int, three int);
|
||||
GRANT DELETE ON atest3 TO GROUP regressgroup2;
|
||||
SET SESSION AUTHORIZATION regressuser1;
|
||||
SELECT * FROM atest3; -- fail
|
||||
ERROR: atest3: permission denied
|
||||
ERROR: permission denied for "atest3"
|
||||
DELETE FROM atest3; -- ok
|
||||
-- views
|
||||
SET SESSION AUTHORIZATION regressuser3;
|
||||
@@ -175,7 +175,7 @@ SELECT * FROM atestv1; -- ok
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM atestv2; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
GRANT SELECT ON atestv1, atestv3 TO regressuser4;
|
||||
GRANT SELECT ON atestv2 TO regressuser2;
|
||||
SET SESSION AUTHORIZATION regressuser4;
|
||||
@@ -187,7 +187,7 @@ SELECT * FROM atestv1; -- ok
|
||||
(2 rows)
|
||||
|
||||
SELECT * FROM atestv2; -- fail
|
||||
ERROR: atestv2: permission denied
|
||||
ERROR: permission denied for "atestv2"
|
||||
SELECT * FROM atestv3; -- ok
|
||||
one | two | three
|
||||
-----+-----+-------
|
||||
@@ -203,7 +203,7 @@ GRANT SELECT ON atestv4 TO regressuser2;
|
||||
SET SESSION AUTHORIZATION regressuser2;
|
||||
-- Two complex cases:
|
||||
SELECT * FROM atestv3; -- fail
|
||||
ERROR: atestv3: permission denied
|
||||
ERROR: permission denied for "atestv3"
|
||||
SELECT * FROM atestv4; -- ok (even though regressuser2 cannot access underlying atestv3)
|
||||
one | two | three
|
||||
-----+-----+-------
|
||||
@@ -216,7 +216,7 @@ SELECT * FROM atest2; -- ok
|
||||
(1 row)
|
||||
|
||||
SELECT * FROM atestv2; -- fail (even though regressuser2 can access underlying atest2)
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
-- privileges on functions, languages
|
||||
-- switch to superuser
|
||||
\c -
|
||||
@@ -226,13 +226,13 @@ GRANT USAGE ON LANGUAGE c TO PUBLIC; -- fail
|
||||
ERROR: language "c" is not trusted
|
||||
SET SESSION AUTHORIZATION regressuser1;
|
||||
GRANT USAGE ON LANGUAGE sql TO regressuser2; -- fail
|
||||
ERROR: sql: permission denied
|
||||
ERROR: permission denied for "sql"
|
||||
CREATE FUNCTION testfunc1(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql;
|
||||
CREATE FUNCTION testfunc2(int) RETURNS int AS 'select 3 * $1;' LANGUAGE sql;
|
||||
REVOKE ALL ON FUNCTION testfunc1(int), testfunc2(int) FROM PUBLIC;
|
||||
GRANT EXECUTE ON FUNCTION testfunc1(int), testfunc2(int) TO regressuser2;
|
||||
GRANT USAGE ON FUNCTION testfunc1(int) TO regressuser3; -- semantic error
|
||||
ERROR: invalid privilege type USAGE for function object
|
||||
ERROR: invalid privilege type USAGE for function
|
||||
GRANT ALL PRIVILEGES ON FUNCTION testfunc1(int) TO regressuser4;
|
||||
GRANT ALL PRIVILEGES ON FUNCTION testfunc_nosuch(int) TO regressuser4;
|
||||
ERROR: function testfunc_nosuch(integer) does not exist
|
||||
@@ -248,12 +248,12 @@ SELECT testfunc1(5), testfunc2(5); -- ok
|
||||
(1 row)
|
||||
|
||||
CREATE FUNCTION testfunc3(int) RETURNS int AS 'select 2 * $1;' LANGUAGE sql; -- fail
|
||||
ERROR: sql: permission denied
|
||||
ERROR: permission denied for "sql"
|
||||
SET SESSION AUTHORIZATION regressuser3;
|
||||
SELECT testfunc1(5); -- fail
|
||||
ERROR: testfunc1: permission denied
|
||||
ERROR: permission denied for "testfunc1"
|
||||
SELECT col1 FROM atest2 WHERE col2 = true; -- fail
|
||||
ERROR: atest2: permission denied
|
||||
ERROR: permission denied for "atest2"
|
||||
SELECT testfunc4(true); -- ok
|
||||
testfunc4
|
||||
-----------
|
||||
@@ -268,7 +268,7 @@ SELECT testfunc1(5); -- ok
|
||||
(1 row)
|
||||
|
||||
DROP FUNCTION testfunc1(int); -- fail
|
||||
ERROR: testfunc1: must be owner
|
||||
ERROR: must be owner of "testfunc1"
|
||||
\c -
|
||||
DROP FUNCTION testfunc1(int); -- ok
|
||||
-- restore to sanity
|
||||
@@ -282,15 +282,15 @@ select has_table_privilege(NULL,'pg_shadow','select');
|
||||
(1 row)
|
||||
|
||||
select has_table_privilege('pg_shad','select');
|
||||
ERROR: Relation "pg_shad" does not exist
|
||||
ERROR: relation "pg_shad" does not exist
|
||||
select has_table_privilege('nosuchuser','pg_shadow','select');
|
||||
ERROR: user "nosuchuser" does not exist
|
||||
select has_table_privilege('pg_shadow','sel');
|
||||
ERROR: has_table_privilege: invalid privilege type sel
|
||||
select has_table_privilege(-999999,'pg_shadow','update');
|
||||
ERROR: pg_class_aclcheck: invalid user id 4293967297
|
||||
ERROR: user with ID 4293967297 does not exist
|
||||
select has_table_privilege(1,'rule');
|
||||
ERROR: pg_class_aclcheck: relation 1 not found
|
||||
ERROR: relation with OID 1 does not exist
|
||||
-- superuser
|
||||
\c -
|
||||
select has_table_privilege(current_user,'pg_shadow','select');
|
||||
@@ -551,7 +551,7 @@ ERROR: grant options can only be granted to individual users
|
||||
SET SESSION AUTHORIZATION regressuser2;
|
||||
GRANT SELECT ON atest4 TO regressuser3;
|
||||
GRANT UPDATE ON atest4 TO regressuser3; -- fail
|
||||
ERROR: atest4: permission denied
|
||||
ERROR: permission denied for "atest4"
|
||||
SET SESSION AUTHORIZATION regressuser1;
|
||||
REVOKE SELECT ON atest4 FROM regressuser3; -- does nothing
|
||||
SELECT has_table_privilege('regressuser3', 'atest4', 'SELECT'); -- true
|
||||
@@ -589,8 +589,8 @@ DROP VIEW atestv1;
|
||||
DROP VIEW atestv2;
|
||||
-- this should cascade to drop atestv4
|
||||
DROP VIEW atestv3 CASCADE;
|
||||
NOTICE: Drop cascades to rule _RETURN on view atestv4
|
||||
NOTICE: Drop cascades to view atestv4
|
||||
NOTICE: drop cascades to rule _RETURN on view atestv4
|
||||
NOTICE: drop cascades to view atestv4
|
||||
-- this should complain "does not exist"
|
||||
DROP VIEW atestv4;
|
||||
ERROR: view "atestv4" does not exist
|
||||
|
||||
@@ -44,7 +44,7 @@ DROP TABLE temptest;
|
||||
CREATE TEMP TABLE temptest(col int);
|
||||
\c regression
|
||||
SELECT * FROM temptest;
|
||||
ERROR: Relation "temptest" does not exist
|
||||
ERROR: relation "temptest" does not exist
|
||||
-- Test ON COMMIT DELETE ROWS
|
||||
CREATE TEMP TABLE temptest(col int) ON COMMIT DELETE ROWS;
|
||||
BEGIN;
|
||||
@@ -78,7 +78,7 @@ SELECT * FROM temptest;
|
||||
|
||||
COMMIT;
|
||||
SELECT * FROM temptest;
|
||||
ERROR: Relation "temptest" does not exist
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user