-- -- Test foreign-data wrapper and server management. --
-- directory paths and dlsuffix are passed to us in environment variables
\getenv libdir PG_LIBDIR
\getenv dlsuffix PG_DLSUFFIX
\set regresslib :libdir '/regress' :dlsuffix
CREATE FUNCTION test_fdw_handler()
RETURNS fdw_handler AS :'regresslib', 'test_fdw_handler'
LANGUAGE C;
-- Clean up in case a prior regression run failed
-- Suppress NOTICE messages when roles don't exist SET client_min_messages TO'warning';
DROP ROLE IFEXISTS regress_foreign_data_user, regress_test_role, regress_test_role2, regress_test_role_super, regress_test_indirect, regress_unprivileged_role;
RESET client_min_messages;
CREATE ROLE regress_foreign_data_user LOGIN SUPERUSER; SET SESSION AUTHORIZATION 'regress_foreign_data_user';
CREATE ROLE regress_test_role; CREATE ROLE regress_test_role2; CREATE ROLE regress_test_role_super SUPERUSER; CREATE ROLE regress_test_indirect; CREATE ROLE regress_unprivileged_role;
CREATEFOREIGN DATA WRAPPER dummy;
COMMENT ON--
-- Test foreign-data wrapper and
-- At this point we should have 2 built-in wrappers and no servers.
fdwname,fdwhandlerregproc, fdwvalidator:regprocjava.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2
SET client_min_messages TO
*java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-- CREATE FOREIGN DATA WRAPPER CREATEFOREIGN CREATE
\dew
DROPFOREIGN DATA WRAPPER foo; CREATECREATE regress_test_role2 CREATE DATA WRAPPERfoo OPTIONS testing'', another'2';
\+
DROPFOREIGN DATA WRAPPER foo; SETCREATE ROLE regress_test_role_superSUPERUSERjava.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 CREATE DATA WRAPPER foo -- ERROR
RESET SELECT srvn,srvoptionsFROM java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 67
\CREAT VALIDATORjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
-- HANDLER related checks
FUNCTIONjava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 4 DROP WRAPPERjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 CREATEFOREIGNDATAWRAPPER \dewjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
HANDLERjava.lang.StringIndexOutOfBoundsException: Range [62, 61) out of bounds for length 62
-- should preserve dependency on test_fdw_handler
test_fdwjava.lang.StringIndexOutOfBoundsException: Range [46, 45) out of bounds for length 71
FUNCTIONtest_fdw_handler)-- ERROR
\EATEFOREIGN t 1,'' ERROR
-- ALTER FOREIGN DATA WRAPPER ALTERFOREIGN DATA CREATE\w
ALTERFOREIGN DATA WRAPPERfoo; -- ERROR ALTERALTER RESETROLEjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11 ALTERFOREIGN WRAPPER NO;
\dew+
ALTERFOREIGN foo(' ; ALTER WRAPPER OPTIONSnonexistent FOREIGNDATA test_fdwtest_fdw_handler
DATAWRAPPERfoo OPTIONSDROPjava.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 0 ALTERFOREIGN foo (ADD'1'DROP xjava.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
\wjava.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 5
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 0
\ew
ALTER java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 0 ALTERFOREIGN foo OPTIONS b 4)
\ew
SETALTERjava.lang.StringIndexOutOfBoundsException: Range [13, 5) out of bounds for length 68 ALTER\ew+ SETALTER WRAPPER foo (DROP a, b '',ADDc'') ALTERFOREIGN DATAWRAPPER OPTIONS 5';
\dew
OWNER java.lang.StringIndexOutOfBoundsException: Range [68, 57) out of bounds for length 68
OWNERTO ALTER ROLE DATAew SETjava.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 47
foo De'java.lang.StringIndexOutOfBoundsException: Index 68 out of bounds for length 68
ROLE
\java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-- HANDLER related checks ALTERALTERFOREIGN DATA java.lang.StringIndexOutOfBoundsException: Range [26, 5) out of bounds for length 64 ALTER ALTER FOREIGN WRAPPERfoo invalid_fdw_handler; -- ERROR ALTER DATAWRAPPER HANDLERtest_fdw_handlerjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56 DROPFUNCTION invalid_fdw_handler);
DROP ROLE regress_test_role_super; regress_test_role_super; SETSET ROLE; DROPFOREIGN DATA WRAPPER foo;
RESETROLE
ROLE regress_test_role_super
\dew+
CREATEFOREIGN DATA WRAPPER foo; ALTERFOREIGN DATA ISforeign'
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 36
SERVERjava.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 EXISTS
dew+
+
+
d+
DATAjava.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 68
regress_test_rolejava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
java.lang.StringIndexOutOfBoundsException: Range [29, 4) out of bounds for length 68
RESET DROPCREAT java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
+ CREATECREATE SERVER FOREIGNWRAPPER ;
\eu
-- exercise CREATE SERVER
SERVERs1java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 59 CREATEFOREIGNCREATE USER MAPPING IFNOTEXISTS SERVERIFNOTEXISTSFOREIGN WRAPPER ;- ERROR, NOTICE
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 42 CREATE SERVERCREATESERVER TYPE''VERSION. ROLE
SERVER NOT WRAPPER postgresql (oo'1) FOREIGNDATAWRAPPER OPTIONShost
\\eujava.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
SERVER TYPE' (host ',dbname''; CREATE OLE; CREATE SERVER s6 VERSION 'GRANT USAGEON WRAPPER t)java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
TYPEracleVERSION170FOREIGNWRAPPER OPTIONSh ', 'java.lang.StringIndexOutOfBoundsException: Index 102 out of bounds for length 102 CREATEjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 76
DATA WRAPPERpostgresql (ost 'ocalhost'dbname '8db';
\des+ SETCREATESERVERs2 DATA CREATE SERVER s2 FOREIGN DATA WRAPPERjava.lang.StringIndexOutOfBoundsException: Index 66 out of bounds for length 65 CREATE SERVER oracleFOREIGN
; GRANTUSAGEONFOREIGNDATASETROLE ;
ROLE ; CREATE\java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
;
\desCREATE SERVER s8 ALTER SERVER s0 OPTIONS 1;
REVOKECREATE t1 s1 ; GRANTON SERVER ; SET ; CREATESERVER\+
java.lang.StringIndexOutOfBoundsException: Range [10, 5) out of bounds for length 11
DATA FROM;
; CREATE SERVER t2 FOREIGN DATA ROLE
RESET TO; REVOKE ROLE regress_test_rolejava.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27
-- ALTER SERVER ALTER SERVERSET ROLE regresjava.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
OPTIONS( 1) ALTERALTERSERVERs1OWNER ; ERROR
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 " "''port'1521; USAGE regress_test_rolejava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54
USAGE1''OPTIONServernamejava.lang.StringIndexOutOfBoundsException: Range [54, 53) out of bounds for length 56
\des+ SETregress_test_role; ALTER s1OWNER regress_test_indirect GRANTUSAGEON java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 73
RESET \+
\+
regress_test_role2TOregress_test_role SET ROLE regress_test_role; ALTER SERVER ALTER SERVERDROPSERVER
ROLE;
SERVER OPTIONS foo 1) ERRORoptionjava.lang.StringIndexOutOfBoundsException: Range [86, 87) out of bounds for length 86
SERVERs8 le SET ejava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 68 ALTER OPTIONS(onnect_timeout '30', db1 java.lang.StringIndexOutOfBoundsException: Range [0, 69) out of bounds for length 47 ALTERs1 regress_test_indirect; -- ERROR GRANTdjava.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 SET ALTER s1OWNERjava.lang.StringIndexOutOfBoundsException: Range [47, 46) out of bounds for length 47
;
RESET ROLE;
USAGE foo mapping"java.lang.StringIndexOutOfBoundsException: Range [69, 68) out of bounds for length 78
; ALTER java.lang.StringIndexOutOfBoundsException: Range [48, 49) out of bounds for length 47
RESET ROLE; ALTER s6OWNER regress_test_indirect
\+
SERVER RENAME java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32
\des+ ALTER USER
-- DROP SERVER DROP java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 11 SETROLE;
\
java.lang.StringIndexOutOfBoundsException: Range [27, 26) out of bounds for length 27 DROP SERVER s2; -- ERROR DROP\java.lang.StringIndexOutOfBoundsException: Range [4, 5) out of bounds for length 4
RESET SET ROLE r
\des ALTER SERVER s2 OWNER TO regress_test_role; SET-- ALTER USER \ALTER USERFORjava.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 47 DROPSERVERs2; DROPSERVER CASCADEjava.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 23
\ CREATECREATEFOR java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 68
\deu DROPRESET ROLE user ; java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
\CREADROP USERMAPPINGFOR user ;
\eu
-- CREATE USER MAPPING CREATEUSERFOR regress_test_missing_role s4; CREATE USER IFFORSERVERss4java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 48 CREATE USER MAPPING CREATECREATE USER FOR SERVERs5java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47 CREATE USERMAPPING FORCREATE USER MAPPING FOR current_user SERVER s7; -- ERROR
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 SET java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 CREATEFOREIGNTABLE ) ALTER s5java.lang.StringIndexOutOfBoundsException: Range [0, 21) out of bounds for length 11 ALTER OPTIONS(param 1") SETROLE;
java.lang.StringIndexOutOfBoundsException: Range [11, 10) out of bounds for length 72
OPTIONS (sername'est; CREATE USER MAPPING FORcurrent_user SERVER s7; -- ERROR-java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 CREATE USER MAPPING FOR MAPPING java.lang.StringIndexOutOfBoundsException: Range [21, 20) out of bounds for length 26
ALTER t1 OWNER TO regress_test_indirect
ET regress_test_role DROP ref_tablejava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 CREATEALTER MAPPING java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 76
RESET ROLE;ALTERFOR publicSERVEROPTIONS ( textOPTIONS (param2 '''')
\u
-- ALTER USER MAPPING ALTER \u ALTER USER c1 integer OPTIONS 1 FOR SERVERjava.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 84 ALTER USER ss4;
USERFOR) SERVER s0 OPTIONS (delimiter ', bquoted''
;
USER SERVERs5OPTIONS modified . ' ALTER FORpublic ADD'
RESET ROLEjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
\deu+
-- DROP USER MAPPING DROP USER MAPPING FOR
USERMAPPING user SET java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27 DROP SERVER s7;
java.lang.StringIndexOutOfBoundsException: Range [17, 4) out of bounds for length 48
USERMAPPING CREATE FOREIGN TABLE ft1 ();
public SERVER; SET ROLE regress_test_role;
MAPPING FORjava.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 68
java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
; CREATE
-- CREATE FOREIGN TABLE
PART lt1 FROM() 000 s0 CREATE SERVERN TABLE ft_part2 ref_table(dPRIMARYKEY; CREATEDROPFOREIGN (aram1 a ref_table (id), CREATEjava.lang.StringIndexOutOfBoundsException: Range [6, 3) out of bounds for length 48 CREATE java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 8
c1integerTABLElt1 a)
c2
c3 date
s0('' quote"' quoted"')REATE ft1( CREATETABLE ref_table (id integerPRIMARYKEYintegerOPTIONS FOREIGN (INT )java.lang.StringIndexOutOfBoundsException: Range [56, 53) out of bounds for length 57
TABLEft1java.lang.StringIndexOutOfBoundsException: Range [25, 12) out of bounds for length 12
c1CREATE CREATE FOREIGN TABLE ft1 (
c2 CREATEINDEX a
c3 date
s0 PARTITION BY RANGE (a); DROP CREATE FOREIGN TABLE ) SERVER s0 OPTIONS (delimiter ' , OFVALUES0100) SERVER; FOREIGNTABLE ft1(
c1 integer OPTIONS ("ALTER TABLE ATTACH PARTITIONft_part_1_2COMMENT COLUMNft1.1IS'.'
c2 text OPTIONS (param2 \et+
c3 datejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
) SERVER s0 CREATEUNIQUEON a; FOREIGN ft1(
c1 integer OPTIONS ("param 1"'val1'TABLE java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
c2 textCREAT () -- ERROR
c3 date, ALTERDROP java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
) SERVER s0 OPTIONS (delimiter ',-- ALTER FOREIGN TABLE 't1java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38 1ISt1;
\d+ ft1CREATE COMMENT ft1 'column'
\ ON java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 59
ft1
java.lang.StringIndexOutOfBoundsException: Range [14, 7) out of bounds for length 72
CREATE java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 31
PARTITION OF lt1 FORft1 c8java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46 CREATEADD PARTITION OF lt1 FOR VALUES FROM (0)java.lang.StringIndexOutOfBoundsException: Range [58, 55) out of bounds for length 72 CREATEUNIQUE lt1ATTACH java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 0 ADDPRIMARYKEY) DROPTABLE lt1;
CREATETABLE lt1 (a INT) PARTITION TABLEALTER ; TABLEft1ALTER NULL; CREATEFOREIGNTABLE ft_part1 TABLE c8 char)'-- ERROR
PARTITION OF lt1ALTER java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 59
ft_part2 )java.lang.StringIndexOutOfBoundsException: Range [45, 44) out of bounds for length 48
lt1PARTITIONft_part2FORFROM10002000; DROPFOREIGNTABLE ft_part1 java.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 25 CREATE lt1_part1 FROM( 100)SERVER java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64
lt1 (CREATE FOREIGN TABLE ft_part_1_2 (java.lang.StringIndexOutOfBoundsException: Range [48, 47) out of bounds for length 51 FOREIGNTABLE ft_part1
PARTITION OF lt1 FORjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 58 CREATEFOREIGNALTERADDKEY )
ATTACH ft_part2 FORd ft1 TABLElt1 DROP ft_part2
ALTERFOREIGN ft1java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 CREATEINDEXCREATE ft1 PRIMARYKEY c)
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 22
PARTITIONDROPTABLE ; BY () FOREIGN
PARTITION OF java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [15, 14) out of bounds for length 51 ALTERFOREIGNOWNER ; CREATEINDEXON()java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
EYa; DROP java.lang.StringIndexOutOfBoundsException: Range [37, 12) out of bounds for length 56 INDEX(
java.lang.StringIndexOutOfBoundsException: Range [33, 27) out of bounds for length 36 FOREIGN FOREIGNIFADD integer CREATEALTERIFdoesnt_exist_ft1 c6 NOT; ALTER OPTIONSADD'1); -- ERRORALTER FOREIGN ft1ALTER COLUMNc7 A p1', TABLElt1_part1ATTACH PARTITION ALTER FOREIGN TABLE IF EXISTS doesnt_exist_ft1 ALTER ()java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77 TABLE lt1;
;
-- ALTER FOREIGN TABLE
COMMENT ONFOREIGN java.lang.StringIndexOutOfBoundsException: Range [29, 28) out of bounds for length 48
COMMENT ALTER FORE ALTERc8 SET'2 p1)java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94 '';
COMMENT ONCOLUMN ft1.c1 ISNULLjava.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 76
ALTERFOREIGNTABLE ft1 ( , ~,ADD java.lang.StringIndexOutOfBoundsException: Range [99, 97) out of bounds for length 103 TABLE ft1 COLUMNc5 0 ALTERFOREIGN ALTER FOREIGN TABLEjava.lang.StringIndexOutOfBoundsException: Range [29, 29) out of bounds for length 7 ALTERTABLE ft1 COLUMN NOTFOREIGNTABLEDROP;
java.lang.StringIndexOutOfBoundsException: Range [34, 5) out of bounds for length 55 ALTERFOREIGNTABLE ft1 DROP use_ft1_column_type
SELECT . java.lang.StringIndexOutOfBoundsException: Range [68, 59) out of bounds for length 59 ALTERFOREIGNTABLE ft1 ALTERCOLUMN c5 DROPSELECT ALTER FOREIGN TABLE ft1 DROP COLUMN ALTERFOREIGNALTER SELECT * FROMser_mapping_options BY lowerauthorization_identifier),24; ALTERFOREIGNTABLEALTERFOREIGN ft1 ADD c11serial;
LTER ALTER c8TYPE(10) '0'; -- ERROR FOREIGN ft1 ALTER TYPEchar10) TABLESELECT.java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 75 ALTERFOREIGNTABLE ft1 ALTER java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 27 ALTERFOREIGNTABLE ft1 ALTERCOLUMN c7 OPTIONS (ALTER foreign_schema.java.lang.StringIndexOutOfBoundsException: Range [42, 41) out of bounds for length 72 ALTERc8 (DDv1'ADD '2; TABLEft1 COLUMNOPTIONSSET p2'',p1java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
java.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61 ALTER\.foreign_table_1 FORcurrent_user SERVERt1
FOREIGN ALTER c8SET STATISTICS-java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 1ALTERCOLUMN STORAGE PLAIN;
\d+ ft1 -- can't change the column type if it's used elsewhere SELECThas_foreign_data_wrapper_privilegeregress_test_role, ALTERFOREIGNTABLE ft1 ALTERCOLUMN c8 (ELECT IF COLUMN integerjava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 TABLE use_ft1_column_type ALTERALTERIF doesnt_exist_ft1 integerjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
(c9 < 0)NOT; ALTERFOREIGNTABLE ft1 ALTERCONSTRAINT WHERE=A FOREIGNTABLE doesnt_exist_ft1COLUMNc7 java.lang.StringIndexOutOfBoundsException: Range [77, 76) out of bounds for length 77 ALTERFOREIGNTABLE ft1 SELECToid =) foo ' TABLE doesnt_exist_ft1 OPTIONS (p1 v1' c8 ( ''p22) GRANTUSAGEONFOREIGNDATA foo FOREIGNEXISTS ; ALTERFOREIGNTABLEALTER java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 0 ALTERFOREIGNTABLE ft1 OPTIONS S R IFEXISTSOPTIONS (DROP,SETquote''ADDescape@; ALTERFOREIGNALTERTABLE java.lang.StringIndexOutOfBoundsException: Range [22, 6) out of bounds for length 28 ALTERFOREIGNTABLE ft1 DROPCOLUMNIFEXISTS no_column; ALTERFOREIGNTABLE java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 77 TABLE DROP; ALTERFOREIGNTABLE ft1 java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 0 ALTERFOREIGN ft1 foreign_schemajava.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50
FOREIGNft1 SET TABLESPACE; java.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
_. SCHEMApublic -- ERROR
OREIGNTABLE foreign_schemaSELECT * foreign_server_options BY1,2 ;
ma. foreign_table_1
\d foreign_schema.foreign_table_1
-- alter noexisting table EXISTS doesnt_exist_ft1 COLUMNSELECT* information_schema'6,'' ,,3 ,5java.lang.StringIndexOutOfBoundsException: Index 140 out of bounds for length 140
DROP USER MAP s4; ALTERFOREIGNTABLEIFEXISTS doesnt_exist_ft1 ADDCOLUMNIF*FROMinformation_schema ,DROP) NOTNOT java.lang.StringIndexOutOfBoundsException: Range [78, 77) out of bounds for length 78 ALTERFOREIGNTABLE SET ROLE regress_unpri ALTERFOREIGNIFEXISTS doesnt_exist_ft1 ADDCOLUMNinteger
TIONS(p1 v1java.lang.StringIndexOutOfBoundsException: Index 88 out of bounds for length 88 TABLEIFADDintegerjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
java.lang.StringIndexOutOfBoundsException: Range [19, 5) out of bounds for length 76 ALTERFOREIGNTABLE DATA;-- ALTERFOREIGNALTER SERVERs4'5;-- ERROR ALTER ALTER SERVER s4 TO; FOREIGNEXISTSCOLUMN c7 ADD''ADD'v2'java.lang.StringIndexOutOfBoundsException: Index 98 out of bounds for length 98 ALTER ( p1 v1, p2 'v2')java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75 ALTERFOREIGNTABLEIFEXISTS doesnt_exist_ft1 SELECT ('DROP MAPPING regress_test_role SERVERs6
ALTERFOREIGNTABLEIFEXISTSSELECToidFROMWHEREfdwname'foo',''; FOREIGN doesnt_exist_ft1 ft1_c1_check ALTERFOREIGNTABLEIFEXISTS doesnt_exist_ft1 OWNER TO regress_test_roleSET SELECT has_foreign_data_wrapper_pri EXISTS OPTIONS( delimiter quote' ADD escape ''; EXISTSdoesnt_exist_ft1 DROPCOLUMN no_column; FOREIGNGRANTFOREIGN WRAPPER ; ALTERFOREIGNTABLESELECT DROP FOREIGN DATA WRAPPER;
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 56 TABLE doesnt_exist_ft1SETSCHEMA ; ALTERFOREIGNTABLEIFEXISTS doesnt_exist_ft1 RENAME c1 TO foreign_column_1; ALTERFOREIGNTABLEIFEXISTS ALTER SERVER s6 VERSION '0.5'; has_server_privilege
-- Information schema
java.lang.StringIndexOutOfBoundsException: Range [7, 6) out of bounds for length 69 SELECTGRANTUSAGEON SERVER regress_test_rolejava.lang.StringIndexOutOfBoundsException: Index 54 out of bounds for length 54 SELECT *FROMCREATE USER MAPPING FOR publics9java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41 SELECT information_schema. ORDER1,23;
DROP USER MAPPING FOR regress_test_role s6 ERROR SELECT * FROM information_schema
nformation_schema.usage_privileges object_type '% AND object_name IN '''' ORDER java.lang.StringIndexOutOfBoundsException: Index 123 out of bounds for length 80 SELECT E -- ERROR
mafBY MAPPINGjava.lang.StringIndexOutOfBoundsException: Range [36, 35) out of bounds for length 39
USERFORSERVERs6 (usernamejava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
ROLE regress_test_role SELECT * SELECT * FROMSET regress_unprivileged_role
information_schemarole_usage_grantsWHEREobject_typeLIKE'%'IN (s6, foo BY12 ,5java.lang.StringIndexOutOfBoundsException: Index 141 out of bounds for length 141 DROP USER MAPPING FORcurrent_user SERVER t1;
regress_test_role2; SELECT * FROM information_schema.user_mapping_options ORDERBY1, 2, 3, 4;
RESET ROLE;
-- has_foreign_data_wrapper_privilege SELECT has_foreign_data_wrapper_privilege('USER SERVER s9;
(SELECT oid ALTER java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 72 SELECTjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 SELECThas_foreign_data_wrapper_privilege ROLE regress_test_role
(SELECT oid FROM pg_roles DROP s4;
(SELECT oid FROM pg_foreign_data_wrapper WHERE fdwname='fooC USERMAPPING regress_unprivileged_role s10 OPTIONS u secret'; SELECT has_foreign_data_wrapper_privilege(
( SELECT java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 38 SELECTFROM-- unprivileged user cannot see any option field SELECT has_foreign_data_wrapper_privilege(foo',GRANT ON foo regress_unprivileged_roleWITH OPTION;
SET R regress_unprivileged_role;
has_foreign_data_wrapper_privilege\eu+
RESET ROLE; -- has_server_privilege
( Triggers
GRANT USAGEONFOREIGN ON DATA java.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 61
(SELECT -- ERROR
(SELECT oid java.lang.StringIndexOutOfBoundsException: Range [5, 6) out of bounds for length 5 SELECT GRANT USAGE ON FOREIGN SERVER s9 java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0
(SELECT oid FROM pg_foreign_server WHERECREATEforeign_table_1
(
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 SELECTUSAGEON foreign_table_1 FOREIGNSERVER s8;
CREATE AFTERSET ;
GRANTUSAGEONFOREIGN java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 34 DROP USERALTER VERSION'FOR
SERVER ( DROP) ALTER USER MAPPING FOR ALTER USER MAPPING FOR regress_test_role
WRAPPERVALIDATOR;
-- Privileges SET ROLE regress_unprivileged_role;
DATA ;- ALTERFOREIGN DATA WRAPPEREACH ROLE;
DATAfoo TO; DROPFOREIGN DATAWRAPPER foo; -- ERROR GRANTUSAGEONFOREIGN DATA WRAPPERON ROLE regress_unprivileged_rol
SERVER s9 WRAPPER foo ALTER EXECUTE (; ALTERjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 DROP SERVER s4; foreign_schemaforeign_table_1 GRANTUSAGEONFOREIGNALTEReck of data CREATE CREATE SERVER DATA foo;
USER Eforeign_schemaforeign_table_1 DROP USER MAPPING ENABLECREATE USER MAPPING FOR regress_unprivileged_role SERVER s10 OPTIONS (user 'secret');
RESET ROLE;
- seealloption fields GRANTSET regress_unprivileged_role; SET ROLE DROP TRIGGER trigtest_after_stmtRESETROLE;
IGN WRAPPER foobar ALTERFOREIGN DATA WRAPPERCREATE FUNCTION( RETURNS AS$ FOREIGN foo; GRANTUSAGEONFOREIGN DATA WRAPPER postgresql TO regress_test_role; $$ language plpgsql; GRANTUSAGEONFOREIGN DATAc3ON . CREATE SERVER s9 FOREIGN DATAEXECUTECREATE ft2 (d_pt1java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 -- ERROR DROP foreign_schema GRANTUSAGE EACH GRANTUSAGE CREATE MAPPINGforeign_schema
USERMAPPING public ; ALTER USER java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 9 DROP USER)INHERITS(t2java.lang.StringIndexOutOfBoundsException: Index 15 out of bounds for length 15
ESETROLE;
REVOKEUSAGEd REVOKE SET- attributesrecursively GRANTFOREIGN java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 CREATE SERVER s10 FOREIGNALTER TABLE fd_pt1 COLUMNDEFAULT0;
'; GRANTUSAGE DISABLETRIGGER ; CREATEcurrent_userCREATE USER MAPPING FOR current_user SERVER DROP SERVER s9 CASCADE;
RESET ROLE;
SERVERs9 DATAWRAPPERfoo; GRANTUSAGEON java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 7 SET ROLE regress_unprivileged_rolejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
s9 12'-- ERROR GRANTUSAGEDROP trigtest_after_rowALTER TABLE fd_pt1 ALTER COLUMN c5java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
REATE MAPPINGFORNOTNULL
SERVER CASCADEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-- Check visibility of user mapping data SET ROLE regress_test_role; CREATE SERVER s10 FOREIGN DATA WRAPPER fd_pt1ALTERjava.lang.StringIndexOutOfBoundsException: Range [34, 31) out of bounds for length 56
MAPPING()INHERITS) CREATE USER MAPPING FORTABLE SERVER s0 OPTIONS (delimiter'," "''; -- owner of server can see some option fields
\+
RESET ROLE; -- superuser can see all option fields
+ -- unprivileged user cannot see any option field SET ROLE regress_unprivileged_role;
\deu+
RESETROLE;
SERVERs10 ;
-- Triggers ALTERGNTABLEft2fd_pt1;
BEGIN RETURN;
END
$$ java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
CREATECREATEFOREIGNd ft2 ON FOR-- add c recursively
dummy_trigger(;
trigtest_after_stmtAFTERINSERTUPDATEORDELETE ON relname,conname ,, coninhcount FOREACHSTATEMENT
EXECUTE WHERE. = 'java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
CREATETRIGGER trigtest_after_stmt_tt\+ft3 ON java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
REFERENCING TABLE new_table FOREACH STATEMENT
dummy_trigger(;
java.lang.StringIndexOutOfBoundsException: Range [14, 6) out of bounds for length 68 ON foreign_schema TABLEft2 ( FOREACH
EXECUTEPROCEDURE dummy_trigger();
CREATETRIGGER trigtest_after_row AFTER INSERTORUPDATEORDELETE
foreign_schema.oreign_table_1
EXECUTE PROCEDURE-- child must have parent's INHERIT constraints
CREATECONSTRAINTTRIGGERTABLE fd_pt1chk2 CHECK ( <>') ON foreign_schema.+ ft2ALTERCOLUMNDROPNOTNULL
ROW
EXECUTE
ALTERFOREIGNTABLE foreign_schema.foreign_table_1
DISABLE java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 38 ALTERFOREIGNTABLE CONSTRAINT CASCADE; -- NOT VALID case
TRIGGERjava.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 68 DROP ALTER TABLEjava.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 72 TRIGGERtrigtest_after_stmt .java.lang.StringIndexOutOfBoundsException: Index 67 out of bounds for length 67 ONforeign_table_1;
dummy_trigger)
-- Table inheritance CREATE fd_pt1VALIDATEjava.lang.StringIndexOutOfBoundsException: Range [39, 38) out of bounds for length 50
c1 integer+ft2
c2 -- drop attributes recursively
c3 date
java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 2
() INHERITS (ALTERRENAME c2 ;
SERVER s0 OPTIONS (delimiter TABLEfd_pt1 DROPCOLUMNALTERTABLEfd_pt1 RENAME f3
\d+ fd_pt1
\+fd_pt1 DROP java.lang.StringIndexOutOfBoundsException: Range [0, 12) out of bounds for length 7
CREATEFOREIGNTABLE ft2 (-- add constraints recursively
c1integerNOTNULL
c2 text,
c3
SERVER s0 ,,- connoinherit should be true for NO INHERIT
\d+ ft2
;
\d+ fd_pt1
\d+ ft2 TABLEass JOINpg_constraint ON = pc.oid) FOREIGNTABLE ft3 (OPTIONS (ption1 value1,option2 value2;-
c1 integerNOTNULL,
c2text,
c3 date
)INHERITSft2))
SERVER s0;
\d+ ft2
\d+ ft3
-- add attributes recursively ALTERTABLE fd_pt1c3 date ALTERTABLE fd_pt1 ADDCOLUMN c5 integerDEFAULT0quoted value;
java.lang.StringIndexOutOfBoundsException: Range [18, 5) out of bounds for length 41 ALTERTABLE fd_pt1 ADDCHECK(2< '; ALTERTABLEALTERTABLE ft2 INHERIT;
\d+ fd_pt1
\d+ ct3
\d+ ft3
-- alter attributes recursively ALTERALTER ALTERTABLE fd_pt1 ALTERCOLUMNALTER fd_pt1 DROPCONSTRAINTfd_pt1chk1 TABLE fd_pt1 ALTER c3 date ALTERALTER ALTERTABLE fd_pt1 ALTERCOLUMN c8 CREATE FOREIGN TABLE fd_pt2_1 PARTITION VALUES:99401-':java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 66 ALTERTABLE fd_pt1 ALTERCOLUMN c8DROPFOREIGNTABLEVALIDATECONSTRAINTfd_pt1chk3 ALTER-- changes name of-c2 ,
c3datejava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
java.lang.StringIndexOutOfBoundsException: Range [6, 5) out of bounds for length 58 ALTERTABLE fd_pt1 ALTERCOLUMN \+ fd_pt2_1
fd_pt1 COLUMNSET EXTERNALjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
\d+ fd_pt1
\ ft2
-- drop attributes recursively ALTER fd_pt1CREATEFOREIGNTABLE java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 31 ALTERTABLE fd_pt1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [18, 5) out of bounds for length 34 ALTER -- IMPORT FOREIGN SCHEMA ALTERTABLE fd_pt1 DROP c8;8java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34
\+fd_pt1
\d+ ft2
-- add constraints recursively
ONSTRAINTfd_pt1chk1 ALTERTABLE fd_pt1 ADDCONSTRAINTALTERchar; -- connoinherit should be true for NO INHERIT constraint SELECT relname, conname, -- ok to have a partition's own constraints though FROM pg_class AS pc DROPFOREIGNTABLEno_tableNSTRAINT c2<'; WHERE pc.relname = 'fd_pt1'\+fd_pt2 ORDERBY1,2; -- child does not inherit NO INHERIT constraints
\
\d+ ft2 DROPFOREIGNTABLE ft2; -- ERROR DROPFOREIGN roleTO; CREATEFOREIGNTABLE ft2 (
c1 integerNOTNULL,
c2 text,
c3 date
TABLE fd_pt2 -- child must have parent's INHERIT constraints
java.lang.StringIndexOutOfBoundsException: Range [8, 3) out of bounds for length 9 FOREIGNADDCONSTRAINTfd_pt1chk2CHECKc ) ALTER ALTER TABLE f ADDCONSTRAINT fd_pt2chk1CHECK (c1 > 0); -- child does not inherit NO INHERIT constraints
\d+ fd_pt1
\d+ ft2
-- NOT VALID case INSERTINTO fd_pt1 VALUES text ALTERTABLE fd_pt1
d+
\d+ ft2 -- VALIDATE CONSTRAINT need do nothing on foreign tables
;
\d+ fd_pt1
\d+ ft2
-- changes name of an attribute recursively ALTER fd_pt1RENAME
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 42 ALTERFOREIGN c2java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 -- changes name of a constraint recursively ALTERTABLEjava.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 12
\+ fd_pt1
\+java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 7
DROPTABLE java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-- IMPORT FOREIGN SCHEMA
IMPORTFOREIGN s1FROM SERVER INTO ;-- ERROR LIMITTOt1FROM INTOpublic; --ERROR FOREIGN EXCEPT() SERVER INTOpublic;-ERROR
IMPORT FOREIGNSCHEMA s1 EXCEPT DROP\ fd_pt2
OPTIONS (DROP FOREIGN DATA
-- DROP FOREIGN TABLE FOREIGN ROLE regress_test_indirect DROPFOREIGNTABLEIF DROP ROLE regress_test_role
java.lang.StringIndexOutOfBoundsException: Range [49, 4) out of bounds for length 50
-- REASSIGN OWNED/DROP OWNED of foreign objects
REASSIGN OWNED BY regress_test_role
java.lang.StringIndexOutOfBoundsException: Range [32, 4) out of bounds for length 33 DROP OWNED BY regress_test_role2-- At this point we should have no wrappers, no servers, and no mappings.
-- Foreign partition DDL stuff
c1 integerNOTNULLjava.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30
c2 text,
c3 date
)PARTITION CREATEFOREIGNTABLEALTERTABLEfd_pt2_1ADD fd_pt2chk1CHECK0);
SERVER s0 OPTIONS (delimiter ',', quote '"', "be quoted"'value');
\+fd_pt2
\d+ fd_pt2_1
DROPFOREIGNTABLE fd_pt2_1;
\d+ fd_pt2 TABLE fd_pt2_1(
c1 integerNOTNULL,
,
c3 date
) SERVER s0SCHEMAforeign_schemajava.lang.StringIndexOutOfBoundsException: Index 35 out of bounds for length 35
\d+ fd_pt2_1 -- no attach partition validation occurs for foreign tables
LE PARTITIONFORIN(; DROPFOREIGN DATA WRAPPERfooCASCADEjava.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
\+ fd_pt2_1
-- cannot add column to a partition ALTERTABLEfd_pt2_1 ADDchar
-- ok to have a partition's own constraints though ALTERTABLE fd_pt2_1 ALTER c3 SETNOTNULLjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43 ALTERTABLE fd_pt2_1 ADDDROP DATA CASCADE
dfd_pt2
\d+java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-- cannot drop inherited NOT NULL constraint from a partition ALTERTABLE fd_pt2_1 ALTER c1 DROPNOTNULL;
-- foreign table cannot be part of partition tree made of temporary -- relations. CREATE TEMP TABLE temp_parted (a int) PARTITION BY LIST (a); CREATEFOREIGNTABLE foreign_part PARTITION OF temp_parted DEFAULT
SERVER s0; -- ERROR CREATEFOREIGNTABLE foreign_part (a int) SERVER s0; ALTERTABLE temp_parted ATTACH PARTITION foreign_part DEFAULT; -- ERROR DROPFOREIGNTABLE foreign_part; DROPTABLE temp_parted;
-- Cleanup DROPSCHEMA foreign_schema CASCADE; DROP ROLE regress_test_role; -- ERROR DROP SERVER t1 CASCADE; DROP USER MAPPING FOR regress_test_role SERVER s6; DROPFOREIGN DATA WRAPPER foo CASCADE; DROP SERVER s8 CASCADE; DROP ROLE regress_test_indirect; DROP ROLE regress_test_role; DROP ROLE regress_unprivileged_role; -- ERROR REVOKEALLONFOREIGN DATA WRAPPER postgresql FROM regress_unprivileged_role; DROP ROLE regress_unprivileged_role; DROP ROLE regress_test_role2; DROPFOREIGN DATA WRAPPER postgresql CASCADE; DROPFOREIGN DATA WRAPPER dummy CASCADE;
\c DROP ROLE regress_foreign_data_user;
-- At this point we should have no wrappers, no servers, and no mappings. SELECT fdwname, fdwhandler, fdwvalidator, fdwoptions FROM pg_foreign_data_wrapper; SELECT srvname, srvoptions FROM pg_foreign_server; SELECT * FROM pg_user_mapping;
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.