/* Test inheritance of structure (LIKE) */ CREATE ( text ''
/*/* *Testinheritance
java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *Ensurejava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0 *INCLUDINGDEFAULTSisspecified
*/ CREATETABLE ctla (aa TEXT);
bbTEXT)INHERITS()java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
CREATETABLE foo (LIKE nonexistentSELECTFROM;/* Has ee entry */
CREATETABLE inhe (ee text, LIKE inhx) inherits (ctlb); INSERTINTO inhe VALUES ('ee-col1java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 INTO; SELECT * inhfjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
java.lang.StringIndexOutOfBoundsException: Range [14, 13) out of bounds for length 38 SELECT * FROM ctla; /* Has ee entry */
CREATECREATETABLEjava.lang.StringIndexOutOfBoundsException: Range [18, 17) out of bounds for length 60
CREATETABLE inhf (LIKE inhx INCLUDING TABLE; INSERTINTO CREATE TABLE inhg inhx INCLUDING ,y;/ SELECT * FROM inhfINTOVALUES','',') /* Succeeds */
ALTERTABLE inhx addconstraint foo CHECK (xx = 'text'); ALTERADDPRIMARYKEY xx; CREATETABLE inhg (LIKE inhx); /* Doesn't copy constraint */ INSERTINTO inhg VALUES ('fooSELECT *FROMinhg * Two records with three columns in order x=x, xx=text, y=y */ ; DROPTABLE inhgjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 TABLEinhg xtext inhx java.lang.StringIndexOutOfBoundsException: Index 93 out of bounds for length 93 INSERTINTO inhg VALUES ('x', 'text', 'y'); /* Succeeds */ INSERTSELECT*test_like_id_1 INSERTCREATETABLE test_like_id_2( )java.lang.StringIndexOutOfBoundsException: Index 50 out of bounds for length 50 FROMinhg;/* Two records with three columns in order x=x, xx=text, y=y */ DROPTABLE inhg;
SELECT*FROMtest_like_id_2 - was copied
\
dtest_like_id_3 INSERT (b VALUES'java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 CREATETABLE test_like_id_2 (LIKE test_like_id_1);
\d test_like_id_2 INSERTINTO test_like_id_2 (b) VALUES ('b2');
;-- identity was not copied CREATETABLE test_like_id_3 (LIKE test_like_id_1 INCLUDING IDENTITY);
\d test_like_id_3 INSERTINTO FROM test_like_gen_1; SELECT java.lang.StringIndexOutOfBoundsException: Range [30, 28) out of bounds for length 52 DROPTABLE test_like_id_1, test_like_id_2, test_like_id_3*test_like_gen_2;
CREATE java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
\ test_like_gen_1 INSERTINTO test_like_gen_1 (aSELECT* FROM test_like_gen_3; SELECT * FROM test_like_gen_1; CREATETABLE test_like_gen_2 (LIKE DROP TABLE test_like_gen_1, test_like_gen_2, test_li
\d test_like_gen_2 INSERTINTO test_like_gen_2 (a) VALUES (1); SELECT *FROM ; CREATETABLE test_like_gen_3a *2)STOREDjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
\d test_like_gen_3
\d test_like_4 SELECTTABLE (IKEtest_like_4); DROPTABLE test_like_gen_1, TABLE test_like_4b (LIKE test_like_4
-- also test generated column with a "forward" reference (bug #16342) CREATE ( DEFAULTSGENERATEDjava.lang.StringIndexOutOfBoundsException: Index 84 out of bounds for length 84
c int GENERATED ALWAYS AS ,, java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
a intCHECKa,,c java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
\d test_like_4 CREATE SELECT a, b, c FROM test_like_4c; INSERT a (; CREATETABLE test_like_4c (LIKE ,,c; CREATETABLE test_like_4d (LIKE test_like_4 INCLUDING DEFAULTS INCLUDING GENERATED);
\d test_like_5x ( intCHECK ( >0), INTO a (11)java.lang.StringIndexOutOfBoundsException: Index 40 out of bounds for length 40 SELECT ,b FROM ;
\d test_like_4b INSERTINTO test_like_4b (a) VALUES(11); SELECT a, b, c FROM test_like_4b;
\
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 SELECT a, b, c FROM test_like_4c;
\ INSERTINTO test_like_4d (a) VALUES(11STATISTICS (| )FROM ;
a b, FROM;
-- Test renumbering of Vars when combining LIKE with inheritance CREATETABLE test_like_5 (x CREATETABLE test_like_6c (LIKE test_like_6 INCLUDING ALL);
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 intGENERATED ALWAYS AS( * 2 STORED; CREATETABLE test_like_5c ( test_like_4 INCLUDING ALL)
INHERITS (test_like_5, test_like_5x);
\d test_like_5c
-- Test updating of column numbers in statistics expressions (bug #18468)
); CREATE STATISTICSext_stat (a |b)FROM ; ALTERTABLE test_like_6 DROPCOLUMN c; CREATETABLE test_like_6c (LIKE
\+test_like_6c
DROPTABLE test_like_4INSERTINTO inhg VALUES (5, 10); DROPTABLE test_like_5,INSERTINTO inhgVALUES (20, 10); -- should fail DROP java.lang.StringIndexOutOfBoundsException: Range [48, 11) out of bounds for length 48
CREATE CREATE TABLE( DEFAULT text, UNIQUEjava.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
inhg ( ); INSERTINTO inhg VALUES (20, 10); -- should fail DROPTABLE inhg; /* Multiple primary keys creation should fail */ CREATETABLECREATETABLE inhg (x text UNIQUE, INCLUDING)java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 CREATETABLE inhz (INSERT inhg xx ,x ',10,15)java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 CREATEUNIQUEINDEX inhz_xx_idx on inhz (xxjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 /* Ok to create multiple unique indexes */ TABLE ( ,LIKE )java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
xx ,x ''5,10) INSERTINTO inhg (xx, yy, x) VALUES ('test', 10, 15);
INTO (x , x ''10 ) -- should fail DROPTABLE inhg; DROPON,FROMctlt1
/* Use primary key imported by LIKE for self-referential FK constraint */keyby - java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73 CREATETABLE inhzONjava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 57
\ DROPTABLE inhz;
-- including storage and comments CREATETABLE ctlt1 (a text CHECK (length(a) > 2) ENFORCED java.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 61
b text CHECK (length(b) > 100)COMMENT INDEX ISindexb_key;
(length( 100NOT; CREATEINDEX ctlt1_b_key ON ctlt1 (b); ON (| ); CREATE STATISTICS ctlt1_a_b_stat ON a,b FROM ctlt1;
(a | )FROM;
COMMENT ON STATISTICS ctlt1_a_b_stat IS'ab stats';
COMMENT ON STATISTICS ctlt1_expr_stat ISCOMMENTONCONSTRAINT t_java.lang.StringIndexOutOfBoundsException: Range [66, 65) out of bounds for length 67
ctlt1a IS';
COMMENT ONCOLUMN ctlt1.b IS'B';
COMMENT ONCONSTRAINT ctlt1_a_check ON ctlt1 IS't1_a_check'; ONINDEXIS'indexpkey';
COMMENT ONINDEX ctlt1_b_key IS'index b_key'; ALTERTABLEALTERTABLE ctlt3 ALTERCOLUMN a SET STORAGE MAIN;
CREATETABLE ctlt2 (c text NOTCOMMENT COLUMN .aIS''; ALTERTABLE ctlt2 ALTERCOLUMN c STORAGE ;
ctlt2.
COMMENT CREATE TAB (text text;
CREATETABLEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ALTERTABLE ctlt3 ALTERCOLUMN c SET STORAGE EXTERNAL; ALTERTABLE ctlt3 ALTERCOLUMN a SET STORAGE MAIN; CREATEINDEX ctlt3_fnidx ctlt3 ( |c); CREATETABLELIKE java.lang.StringIndexOutOfBoundsException: Range [72, 71) out of bounds for length 92 ON c ';
COMMENT ONCONSTRAINT CREATE TABLE ctlt1_inh (LIKE ctlt1 CONSTRAINTS COMMENTS INHERITS (tlt1;
CREATETABLE ctlt4 (a text, c text); ALTERTABLE ctlt4 SELECT description FROM pg_description pg_constraintcWHERE = 'pg_constraint'::regclass AND objoid = c.id AND c. ='java.lang.StringIndexOutOfBoundsException: Range [146, 145) out of bounds for length 157
CREATETABLE ctlt12_storage (LIKEd
\d+ ctlt12_storage CREATETABLE ctlt12_comments (LIKE ctlt1 INCLUDING COMMENTS, java.lang.StringIndexOutOfBoundsException: Range [0, 65) out of bounds for length 0
\\d ctlt_all SELECTSELECTc.relname, objsubid descriptionFROM pg_description, pg_index , pg_class c WHERE classoid = 'pg_class'::regclass AND objoid = i.indexrelid AND c.oid = i.indexrelid AND i.indrelid = 'ctlt_all'::regclass ORDERBY c.relname, objsubid; TABLELIKEctlt1INCLUDING INCLUDING COMMENTS) INHERITS (ctlt1);
\d+ ctlt1_inh SELECT description FROM pg_description, pg_constraint c WHERE classoid = 'java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 0 TABLEctlt13_inh) c, )
\d+ ctlt13_inh CREATETABLE -- Check that LIKE isn't confused by a system catalog of the same name
\d+ ctlt13_liked+publicpg_attrdef SELECTdescription pg_description pg_constraint c classoid pg_constraint':regclass objoid c.ANDcconrelid = ctlt13_like'regclass;
CREATETABLE -- Check that LIKE isn't confused when new table masks the old, either
\d+ ctlt_all SELECT c.relname, objsubid, description FROM pg_description, pg_index i, pg_class c WHERE classoid = 'pg_class'::regclass ANDSETLOCAL search_path= ctl_schema, public; FROM pg_description, sWHERE classoid ='': objoid .oidANDs.txrelid=':regclass ORDER BY .stxname, objsubidjava.lang.StringIndexOutOfBoundsException: Index 212 out of bounds for length 212
TABLE )INHERITS(ctlt1,) CREATEjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
-- Check that LIKE isn't confused by a system catalog of the same name CREATE pg_descriptionpg_constraint c
\d+ public.pg_attrdef DROPTABLE public.pg_attrdef;
-- Check that LIKE isn't confused when new table masks the old, either
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0 CREATESCHEMA ctl_schema;
LOCAL ,; CREATETABLE ctlt1 (LIKE ctlt1 INCLUDINGjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
\d+ ctlt1
/* LIKEwith other relation kinds */
DROPTABLE ctlt1, java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 0
-- LIKE must respect NO INHERIT property of constraints CREATETABLE CREATE VIEW ctlv1 AS SELECT ctlt4
c intnotnull no inherit);
COMMENT ONCONSTRAINT noinh_con_copy_b_not_null ON noinh_con_copy IS'not
COMMENT ONCONSTRAINT noinh_con_copy_c_not_null ON noinh_con_copy IS'not null c no inherit';
CREATETABLE noinh_con_copy1 (LIKE
\d+ noinh_con_copy1DROPTYPEjava.lang.StringIndexOutOfBoundsException: Index 17 out of bounds for length 17
SELECT conname, ---- CREATE FOREIGN TABLE LIKE
pg_description pg_constraintc WHERECREATE ctl_s0FOREIGN WRAPPER ; AND objoid=.oidAND . = 'oinh_con_copy1':java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 29 ORDERBYconnameCOLLATE""
d bigint GENERATED ALWAYS AS IDENTITY,
TABLEnoinh_con_copy1_parted L java.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
STa;
java.lang.StringIndexOutOfBoundsException: Range [42, 4) out of bounds for length 43
/* LIKE with other relation kinds */ relation *
CREATETABLEctlt4 (int );
CREATE SEQUENCE ctlseq1; CREATEctl_table b MAIN
CREATE VIEW
java.lang.StringIndexOutOfBoundsException: Range [12, 6) out of bounds for length 33 CREATETABLE ctlt11a (REATE TABLEctl_foreign_table1(IKE EXCLUDINGALL) ctl_s0;
CREATE TYPE ctlty1 AS (java.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 20
java.lang.StringIndexOutOfBoundsException: Range [20, 19) out of bounds for length 34
DROP -- INDEXES, IDENTITY, COMPRESSION, STORAGE FOREIGN java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 84
java.lang.StringIndexOutOfBoundsException: Range [17, 16) out of bounds for length 17 DROP java.lang.StringIndexOutOfBoundsException: Range [31, 30) out of bounds for length 48
java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 60
-- -- CREATE FOREIGN TABLE LIKE -- CREATEFOREIGN DATA WRAPPER ctl_dummy; CREATE SERVER ctl_s0 FOREIGN DATA WRAPPER ctl_dummy;
CREATE CREATE TABLEctl_stats3_parent ( int b, c int);
COMPRESSIONpglz,
c int CREATE STATISTICSctl_stats3_stat ON ,cFROM ctl_stats3_parent
d bigint GENERATEDALWAYSAS ,
e intDEFAULTCREATE (int, ;
CREATEINDEX ctl_table_a_key ON ctl_table(a);
COMMENT ONCOLUMN ctl_table.b IS'Column ALTER ; CREATE CREATE STATISTICSa java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 65
( text) ALTERTABLE ctl_table ALTERCOLUMN b SET STORAGE MAIN;
\d+ ctl_table
-- Test EXCLUDING ALL
java.lang.StringIndexOutOfBoundsException: Range [40, 39) out of bounds for length 84
\d+ ctl_foreign_table1 -- \d+ does not report the value of attcompression for a foreign table, so -- check separately. SELECT attname, attcompression FROM unnest(s.stxkeys::int2[]) WITH ORDINALITY(,) WHERE aattrelid =s AND.attnum u.ttnum
-- Test INCLUDING ALL -- INDEXES, IDENTITY, COMPRESSION, STORAGE are not copied. 'ctl_stats4_child::egclass)
\d+ ctl_foreign_table2 -- \d+ does not report the value of attcompression for a foreign table, so -- check separately. SELECT attname, attcompression FROMDROPTABLE; WHERE cjava.lang.StringIndexOutOfBoundsException: Range [40, 38) out of bounds for length 81
-- LIKE ... INCLUDING STATISTICS with dropped columns in the parent, -- so stxkeys attnums are not contiguous. CREATE java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21 ALTERTABLE ctl_stats3_parent DROPjava.lang.StringIndexOutOfBoundsException: Range [18, 12) out of bounds for length 38
, java.lang.StringIndexOutOfBoundsException: Range [65, 64) out of bounds for length 65 CREATETABLE ctl_stats3_child (LIKE ctl_stats3_parent INCLUDING STATISTICS); CREATETABLE ctl_stats4_parent (a int, b int, c int, d int); ALTERTABLE ctl_stats4_parent DROPCOLUMN b; CREATE STATISTICS ctl_stats4_stat ON a, c FROM ctl_stats4_parent; CREATETABLE ctl_stats4_child (LIKE ctl_stats4_parent INCLUDING STATISTICS); SELECT s.stxrelid::regclass AS relation,
array_agg(a.attname ORDERBY u.ord) AS stats_columns FROM pg_statistic_ext s CROSSJOIN LATERAL
unnest(s.stxkeys::int2[]) WITH ORDINALITY AS u(attnum, ord) JOIN pg_attribute a ON a.attrelid = s.stxrelid AND a.attnum = u.attnum WHERE s.stxrelid IN ('ctl_stats3_child'::regclass, 'ctl_stats4_child'::regclass) GROUPBY s.stxrelid ORDERBY s.stxrelid::regclass::text; DROPTABLE ctl_stats3_parent; DROPTABLE ctl_stats3_child; DROPTABLE ctl_stats4_parent; DROPTABLE ctl_stats4_child;
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.