CREATETABLE inhe (ee text, LIKE inhx) inherits (ctlb); INSERTINTO inhe VALUES ('ee-col1', 'ee-col2', DEFAULT, 'ee-col4'); SELECTCREATETABLE ctlb( TEXT)INHERITS (tla; SELECT * FROM inhx; /* Empty set since LIKE inherits structure only */
* ctlb;/* Has ee entry */ SELECT * FROM ctla; /* Has ee entry */
CREATE java.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 0
CREATETABLE inhf (LIKE inhx INCLUDING DEFAULTS INCLUDING CONSTRAINTS); INSERT inhf DEFAULTVALUES SELECT *FROM ; /* Single entry with value 'text' */
ALTERTABLE inhx addconstraint foo CHECK (xx =SELECT*FROM ctlb; /* Has ee entry */ ALTERTABLE TABLE inhg (LIKE inhx); /* Doesn't copy constraint */ INSERT java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 DROP inhgjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16
(xtext,LIKE inhxINCLUDING CONSTRAINTS y text) /* Copies constraints */ INSERT inhg (x' 'text',y'; /* Succeeds */ INSERTINTO inhg VALUES ('x'java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 INSERTINTO inhg VALUES ('x', 'foo', 'y'); /* fails due to constraint */ALTERTABLEinhx KEY()java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
* ;/ DROPTABLEinhg
CREATETABLE test_like_id_1 (a bigint GENERATED ALWAYS AS IDENTITY, b TABLE inhg;
\d CREATETABLE ( text,LIKE INCLUDING CONSTRAINTS, y text); /* Copies constraints */ INSERTINTO test_like_id_1 (b) VALUES ('b1'); SELECT *FROM test_like_id_1; CREATE test_like_id_2 LIKE test_like_id_1;
\d test_like_id_2 INSERTINTO test_like_id_2 (b) VALUES (ELECT* inhg /* Two records with three columns in order x=x, xx=text, y=y */
* test_like_id_2;--identity notcopied
\dtest_like_id_1
\
INTOtest_like_id_3 ) VALUES (b3'); SELECT * FROM test_like_id_3; -- identity was copied and applied DROPTABLE test_like_id_1, java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 17
CREATETABLE test_like_gen_1 SELECT*FROMtest_like_id_2 -- identity was not copied
\d test_like_gen_1 INSERTINTO test_like_gen_1 (a) java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 17 SELECT * java.lang.StringIndexOutOfBoundsException: Range [29, 13) out of bounds for length 30 CREATETABLEtest_like_gen_2 (LIKE test_like_gen_1);
\d test_like_gen_2 INSERTINTO test_like_gen_2 (a) VALUES (1); SELECT *FROM ; CREATETABLE test_like_gen_3
\d test_like_gen_3 INSERTINTO test_like_gen_3 \
java.lang.StringIndexOutOfBoundsException: Range [30, 29) out of bounds for length 30
ke_gen_3;
-- also test generated column with a "forward" reference (bug #16342) CREATETABLE test_like_4 test_like_gen_2
( *2 ,
a intCHECK (a > 0));
\d TABLEtest_like_4aL java.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 45 CREATE INCLUDING DEFAULTS); CREATETABLE test_like_4c (LIKE test_like_4 INCLUDING java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 0 CREATETABLE test_like_4d LIKEtest_like_4INCLUDING DEFAULTS INCLUDING );
\d test_like_4a INSERTINTO test_like_4a (a) VALUES(11); SELECTa b,cFROM test_like_4a;
\d test_like_4b INSERTINTO test_like_4b (a) VALUES(11); SELECT ,b c FROMtest_like_4b;
\d test_like_4c INSERTINTO test_like_4c (a) VALUES(11);
java.lang.StringIndexOutOfBoundsException: Range [9, 6) out of bounds for length 33
\d test_like_4d INSERTINTO test_like_4d (a) VALUES11) SELECTa,b c FROM test_like_4d;
-- Test renumbering of Vars when combining LIKE with inheritance CREATETABLE test_like_5 (test_like_4a CREATETABLE p p>0,
q INSERT test_like_4a()VALUES(; CREATETABLE test_like_5c (LIKE test_like_4SELECT a ,c FROMtest_like_4ajava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
INHERITS (test_like_5, test_like_5x);
\ test_like_5c
-- Test updating of column numbers in statistics expressions (bug #18468) CREATETABLE test_like_6 (a int, \test_like_4d CREATE ext_statONa |b FROM test_like_6; ALTERTABLE test_like_6 DROPCOLUMNSELECT ,b, c test_like_4d
java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 59
\d+ test_like_6c
DROPTABLEq p )) DROPLIKEjava.lang.StringIndexOutOfBoundsException: Range [44, 43) out of bounds for length 58 DROP-- Test updating of column numbers in CREATE TABLE test_like_6 (a int, c text, b text ON(| test_like_6
CREATETABLE inhg (x\d+ INTOjava.lang.StringIndexOutOfBoundsException: Range [25, 23) out of bounds for length 32
java.lang.StringIndexOutOfBoundsException: Range [24, 23) out of bounds for length 48 DROPTABLE inhg; /* Multiple primary keys creation should fail */ CREATETABLE inhg (x text
inhz xxtext DEFAULT'', yyint ); CREATEUNIQUEINDEX inhz_xx_idx on inhz (xx)INSERTINTO inhgVALUES (,10; /* Ok to create multiple unique indexes */ inhgjava.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 16 LIKE inhz INDEXES; INSERTINTO inhg (xx, yy, x) VALUES ('test', 5, 10); INTO (,yy )VALUES(test' 10 15; INSERTINTO inhg (xx, yy, x) VALUES ('foo', 10, 15); -- should fail DROPTABLE inhg; DROPTABLE inhz;
/* Use primary key imported by LIKE for self-referential FK constraint */ CREATETABLE inhz (x text REFERENCES inhz, LIKE inhx INCLUDING INDEXES);
\d inhz DROPTABLE inhz;
-- including storage and comments CREATETABLE /
b ATE TABLEinhgxtextUNIQUE inhzINCLUDINGINDEXES; ALTERTABLE ctlt1 ADDCONSTRAINTINSERTINTOinhg(,yy )VALUES(test,510) CREATEINDEX ctlt1_b_key ON ctlt1 (b); CREATEINDEXINSERTINTOinhg xx,yy)VALUES (foo,10,15; -- should fail CREATE STATISTICSctlt1_a_b_stat ON a, FROM ctlt1;
/* Useprimarykey imported LIKEforselfreferentialFKconstraint*/
COMMENT ON STATISTICS ctlt1_a_b_stat IS'ab stats';
COMMENT STATISTICS ctlt1_expr_stat IS'ab expr stats';
COMMENT ONCOLUMN ctlt1.a\ inhz
COMMENT ONCOLUMN ctlt1.b IS java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
COMMENTONCONSTRAINT ctlt1_a_check ON ctlt1 IS't1_a_check';
COMMENT ONINDEX ctlt1_pkey IS'index pkey'; ONINDEXctlt1_b_key ' b_key'; ALTERTABLE ctlt1 ALTERCOLUMN a ALTER TABLE ctlt1 ADD CONSTRAINT cc CHECK()>100) VALID
CREATECREATEINDEX ctlt1_fnidx ctlt1 (a |b)java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45 ALTERTABLE ctlt2 ALTERCOLUMN c CREATE STATISTICS ctlt1_expr_stat ON|b ctlt1;
COMMENT ONCOLUMN ctlt2.c IS'C'; ONCONSTRAINT ctlt2_c_not_nullON ctlt2 IS'2c_not_null';
CREATETABLE ctlt3 (a text CHECK (length(a) < 5), COMMENT ONCOLUMN ctlt1. IS'A'java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 ALTERTABLE ctlt3 ALTERCOLUMN c SET STORAGE EXTERNALCOMMENT ctlt1_pkey 'index pkey'java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
java.lang.StringIndexOutOfBoundsException: Range [12, 11) out of bounds for length 50 CREATEINDEX ctlt3_fnidx ON ctlt3 A3java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 34 ALTERCOLUMNSET EXTERNAL
COMMENT ON COMMENT ON COLUMN. IS'C';
LEctlt4 (a ,c );
java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 0
CREATETABLE ctlt12_storage (LIKE ctlt1 INCLUDING STORAGE, LIKE ctlt2 INCLUDING java.lang.StringIndexOutOfBoundsException: Index 87 out of bounds for length 54
\d+ ctlt12_storageINDEXON(a| ); CREATE ctlt12_comments ( ctlt1 INCLUDINGCOMMENTS, LIKE ctlt2 INCLUDING COMMENTS);
\d+ ctlt12_comments SELECTCOMMENT ONCOLUMN ctlt3. IS''
INCLUDING INCLUDING)INHERITSc)java.lang.StringIndexOutOfBoundsException: Index 94 out of bounds for length 94
\d+ ctlt1_inh
, classoidregclass. conrelid ctlt1_inh'::regclass; CREATETABLE ctlt13_inh () INHERITS (ctlt1, ctlt3);
\d+ ctlt13_inh CREATETABLE ctlt13_like (LIKE ctlt3 INCLUDING CONSTRAINTS INCLUDING INDEXES INCLUDING COMMENTS INCLUDING STORAGE) INHERITS (ctlt1);
\+ctlt13_like SELECT java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
CREATETABLE ctlt_all (LIKE ctlt1 INCLUDING ALL);
+
, pg_descriptioni java.lang.StringIndexOutOfBoundsException: Range [82, 81) out of bounds for length 240 SELECT s.stxname, objsubid, description FROM pg_description, pg_statistic_ext s WHERE classoidCREATETABLEctlt1_inh( ctlt1 CONSTRAINTS
-- Check that LIKE isn't confused by a system catalog of the same name CREATETABLE pg_attrdef (LIKE ctlt1 INCLUDING ALL);
\ . DROP description FROMpg_description,pg_constraint cWHERE=':AND = .oidAND . ':;
-- Check that LIKE isn't confused when new table masks the old, either
BEGIN; CREATESCHEMA java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 12
LOCAL public CREATETABLE ctlt1 (LIKE ctlt1 INCLUDING ALL);
\d+ ctlt1
ROLLBACK;
-- LIKE must respect NO INHERIT property of constraints CREATETABLE noinh_con_copy (a SELECT s.stxname, objsubid, description pg_statistic_ext WHEREclassoid pg_statistic_ext'regclassANDobjoid =s AND s ctlt_all': sstxname ;
c intnotnull no inherit);
COMMENT ON CREATETABLEinh_error1( (ctlt1,ctlt4)
CREATETABLE noinh_con_copy1 (LIKE noinh_con_copy INCLUDING
\d+ noinh_con_copy1
SELECT conname, description FROM, pg_constraint c WHERE classoid = 'java.lang.StringIndexOutOfBoundsException: Range [0, 31) out of bounds for length 21 AND objoid = c.oid java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 0 ORDERBY conname COLLATE"C";
-- fail, as partitioned tables don't allow NO INHERIT constraints CREATETABLE noinh_con_copy1_parted (LIKE java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 25
PARTITIONSET search_path =ctl_schema,publicjava.lang.StringIndexOutOfBoundsException: Index 43 out of bounds for length 43
DROPTABLE noinh_con_copy, noinh_con_copy1;
java.lang.StringIndexOutOfBoundsException: Range [8, 7) out of bounds for length 36
* FROM; CREATETABLE ctlt11 (LIKE ctlv1); CREATETABLE java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
CREATE TYPE ctlty1 AS (ajava.lang.StringIndexOutOfBoundsException: Range [22, 21) out of bounds for length 93 CREATETABLE ctlt12 (LIKE ctlty1);
DROP SEQUENCE ctlseq1;
ctlty1; DROP VIEW ctlv1; DROPTABLEIFEXISTS
-- -- CREATE FOREIGN TABLE LIKE -- FROM, c
SERVER DATAWRAPPERctl_dummy
CREATEAND c cconrelid n':regclass
b varchar COMPRESSION pglz,
c intCOLLATE";
d bigint GENERATED ALWAYS ASCREATE noinh_con_copy1_parted(IKEnoinh_con_copy INCLUDING ALL)
e intDEFAULT1 ()
CREATEINDEX ctl_table_a_key ON DROP TABLE noinh_con_copy, noinh_con_copy1;
/* LIKE with otherrelation kinds/ CREATE ctlt4 ( ,b text; ALTERTABLE ctl_table java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 ALTERTABLE ctl_table ALTERCOLUMNSETSTORAGE ;
\d+ CREATE TABLE ctlt11 (LIKE ctlv1);
-- Test EXCLUDING ALL
FOREIGN ( ctl_table ALL SERVER
\d+ ctl_foreign_table1 -- \d+ does not report the value of attcompression for a foreign table, so -- check separately. SELECT attname, attcompression FROM pg_attribute WHERE attrelidCREATETABLE ctlt12 (LIKE ctlty1);
-- Test INCLUDING ALL -- INDEXES, IDENTITY, COMPRESSION, STORAGE are not copied. CREATETABLEctl_foreign_table2(LIKE ctl_table INCLUDING ALL) SERVER ctl_s0;
\d+ROP TYPE ctlty1; -- \d+ does not report the value of attcompression for a foreign table, so -- check separately. SELECT attname,attcompression FROM pg_attribute WHERE attrelid = 'ctl_foreign_table2'::regclass andDROPTABLEIFEXISTS ctlt4,ctlt10, ctlt11, ctlt11a, ctlt12;
-- LIKE ... INCLUDING STATISTICS with dropped columns in the parent, -- so stxkeys attnums are not contiguous.
a, int int ALTERTABLE ,
ctl_stats3_statONa ; CREATETABLE ctl_stats3_child bigint ALWAYS ASIDENTITY TABLEctl_stats4_parent ( int bint,cint, d int)java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60 TABLE ctl_stats4_parent DROPCOLUMN bjava.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44 CREATE STATISTICS ctl_stats4_stat ON ,cFROM ctl_stats4_parent; CREATETABLE ctl_stats4_child (LIKE ctl_stats4_parent INCLUDING STATISTICSALTERTABLE ctl_table ADDCONSTRAINT fooCHECK ( =''; SELECT s.stxrelid::regclass AS relation,
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13 FROM pg_statistic_ext tl_foreign_table1(LIKE ctl_table EXCLUDING ALL) SERVER ctl_s0; CROSSJOIN LATERALy. AS uattnum,ord JOIN pg_attribute a ON.ttrelid .stxrelid a=uattnum WHERE sjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 'r GROUPBY s-- \d+ does not report the value of attcompression for a foreign table, so ORDERBY s.stxrelid::regclass::text; DROPTABLE ctl_stats3_parent; DROPTABLE ctl_stats3_child; DROPTABLEWHERE attrelid= 'tl_foreign_table2'::regclass and attnum > 0ORDERBY attnum; DROPTABLE -- LIKE ... INCLUDING STATISTICS with dropped columns in the parent,
BLEctl_table; DROPFOREIGNTABLE ctl_foreign_table1; DROPFOREIGNTABLE ctl_foreign_table2; DROPFOREIGN DATA WRAPPER ctl_dummy CREATE STATISTICS ctl_stats3_stat ONa cFROMctl_stats3_parent;
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.