You can subscribe to this list here.
2010 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
(28) |
Jun
(12) |
Jul
(11) |
Aug
(12) |
Sep
(5) |
Oct
(19) |
Nov
(14) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
(18) |
Feb
(30) |
Mar
(115) |
Apr
(89) |
May
(50) |
Jun
(44) |
Jul
(22) |
Aug
(13) |
Sep
(11) |
Oct
(30) |
Nov
(28) |
Dec
(39) |
2012 |
Jan
(38) |
Feb
(18) |
Mar
(43) |
Apr
(91) |
May
(108) |
Jun
(46) |
Jul
(37) |
Aug
(44) |
Sep
(33) |
Oct
(29) |
Nov
(36) |
Dec
(15) |
2013 |
Jan
(35) |
Feb
(611) |
Mar
(5) |
Apr
(55) |
May
(30) |
Jun
(28) |
Jul
(458) |
Aug
(34) |
Sep
(9) |
Oct
(39) |
Nov
(22) |
Dec
(32) |
2014 |
Jan
(16) |
Feb
(16) |
Mar
(42) |
Apr
(179) |
May
(7) |
Jun
(6) |
Jul
(9) |
Aug
|
Sep
(4) |
Oct
|
Nov
(3) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
1
(2) |
2
(3) |
3
|
4
(2) |
5
(3) |
6
(2) |
7
(8) |
8
(12) |
9
|
10
|
11
(17) |
12
(16) |
13
(4) |
14
(3) |
15
(5) |
16
|
17
|
18
(1) |
19
(3) |
20
(2) |
21
(1) |
22
(1) |
23
|
24
|
25
(3) |
26
(1) |
27
|
28
|
29
|
30
|
From: Abbas B. <ga...@us...> - 2011-04-08 15:46:17
|
Project "Postgres-XC". The branch, master has been updated via 43675e5f56beb98419514bd23997bc178e005a6f (commit) from 48986620f70d0220524e715061b76824ac9684c6 (commit) - Log ----------------------------------------------------------------- commit 43675e5f56beb98419514bd23997bc178e005a6f Author: Abbas <abb...@en...> Date: Fri Apr 8 20:34:58 2011 +0500 This patch fixes bug ID 3280980 in which ORDER BY BIT fails The reason of the failure was in the function create_tuple_desc. The function do_query sends the query to appropriate nodes and then reads the results. It then calls handle_response function to process messages received from the nodes. On receiving the RowDescription message, the function calls HandleRowDescription to create tuple descriptor from row description message. In the function create_tuple_desc type mode was being ignored as received in the row description. Instead the function was asking parseTypeString to decode type modifier from type name. Although the BIT array was defined to be 11 bits long, the function would report that type modifier is 1. This was causing the query to fail. This patch changes the code so that it now no longer ignores the type mode received in the row description message. diff --git a/src/backend/pgxc/pool/execRemote.c b/src/backend/pgxc/pool/execRemote.c index 848a3cc..700268a 100644 --- a/src/backend/pgxc/pool/execRemote.c +++ b/src/backend/pgxc/pool/execRemote.c @@ -410,7 +410,7 @@ create_tuple_desc(char *msg_body, size_t len) char *attname; char *typname; Oid oidtypeid; - int32 typmod; + int32 typemode, typmod; uint32 n32; attnum = (AttrNumber) i; @@ -435,14 +435,16 @@ create_tuple_desc(char *msg_body, size_t len) /* type len, ignored */ msg_body += 2; - /* type mod, ignored */ + /* type mod */ + memcpy(&typemode, msg_body, 4); + typmod = ntohl(typemode); msg_body += 4; /* PGXCTODO text/binary flag? */ msg_body += 2; /* Get the OID type and mode type from typename */ - parseTypeString(typname, &oidtypeid, &typmod); + parseTypeString(typname, &oidtypeid, NULL); TupleDescInitEntry(result, attnum, attname, oidtypeid, typmod, 0); } ----------------------------------------------------------------------- Summary of changes: src/backend/pgxc/pool/execRemote.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) hooks/post-receive -- Postgres-XC |
From: Michael P. <mic...@us...> - 2011-04-08 09:02:29
|
Project "Postgres-XC". The branch, master has been updated via 48986620f70d0220524e715061b76824ac9684c6 (commit) from 9a329381083f831459db12cdd6616552c4571c5b (commit) - Log ----------------------------------------------------------------- commit 48986620f70d0220524e715061b76824ac9684c6 Author: Michael P <mic...@us...> Date: Fri Apr 8 17:57:02 2011 +0900 Fix for regression test create_index XC does not support yet concurrent index, TEMP table and INTO clause, so this output is correct. Query plan is set now as a Data node scan. diff --git a/src/test/regress/expected/create_index_1.out b/src/test/regress/expected/create_index_1.out new file mode 100644 index 0000000..0c5b67d --- /dev/null +++ b/src/test/regress/expected/create_index_1.out @@ -0,0 +1,963 @@ +-- +-- CREATE_INDEX +-- Create ancillary data structures (i.e. indices) +-- +-- +-- BTREE +-- +CREATE INDEX onek_unique1 ON onek USING btree(unique1 int4_ops); +CREATE INDEX onek_unique2 ON onek USING btree(unique2 int4_ops); +CREATE INDEX onek_hundred ON onek USING btree(hundred int4_ops); +CREATE INDEX onek_stringu1 ON onek USING btree(stringu1 name_ops); +CREATE INDEX tenk1_unique1 ON tenk1 USING btree(unique1 int4_ops); +CREATE INDEX tenk1_unique2 ON tenk1 USING btree(unique2 int4_ops); +CREATE INDEX tenk1_hundred ON tenk1 USING btree(hundred int4_ops); +CREATE INDEX tenk1_thous_tenthous ON tenk1 (thousand, tenthous); +CREATE INDEX tenk2_unique1 ON tenk2 USING btree(unique1 int4_ops); +CREATE INDEX tenk2_unique2 ON tenk2 USING btree(unique2 int4_ops); +CREATE INDEX tenk2_hundred ON tenk2 USING btree(hundred int4_ops); +CREATE INDEX rix ON road USING btree (name text_ops); +CREATE INDEX iix ON ihighway USING btree (name text_ops); +CREATE INDEX six ON shighway USING btree (name text_ops); +-- test comments +COMMENT ON INDEX six_wrong IS 'bad index'; +ERROR: relation "six_wrong" does not exist +COMMENT ON INDEX six IS 'good index'; +COMMENT ON INDEX six IS NULL; +-- +-- BTREE ascending/descending cases +-- +-- we load int4/text from pure descending data (each key is a new +-- low key) and name/f8 from pure ascending data (each key is a new +-- high key). we had a bug where new low keys would sometimes be +-- "lost". +-- +CREATE INDEX bt_i4_index ON bt_i4_heap USING btree (seqno int4_ops); +CREATE INDEX bt_name_index ON bt_name_heap USING btree (seqno name_ops); +CREATE INDEX bt_txt_index ON bt_txt_heap USING btree (seqno text_ops); +CREATE INDEX bt_f8_index ON bt_f8_heap USING btree (seqno float8_ops); +-- +-- BTREE partial indices +-- +CREATE INDEX onek2_u1_prtl ON onek2 USING btree(unique1 int4_ops) + where unique1 < 20 or unique1 > 980; +ERROR: relation "onek2" does not exist +CREATE INDEX onek2_u2_prtl ON onek2 USING btree(unique2 int4_ops) + where stringu1 < 'B'; +ERROR: relation "onek2" does not exist +CREATE INDEX onek2_stu1_prtl ON onek2 USING btree(stringu1 name_ops) + where onek2.stringu1 >= 'J' and onek2.stringu1 < 'K'; +ERROR: relation "onek2" does not exist +-- +-- GiST (rtree-equivalent opclasses only) +-- +CREATE INDEX grect2ind ON fast_emp4000 USING gist (home_base); +CREATE INDEX gpolygonind ON polygon_tbl USING gist (f1); +CREATE INDEX gcircleind ON circle_tbl USING gist (f1); +CREATE INDEX gpointind ON point_tbl USING gist (f1); +CREATE TEMP TABLE gpolygon_tbl AS + SELECT polygon(home_base) AS f1 FROM slow_emp4000; +ERROR: INTO clause not yet supported +INSERT INTO gpolygon_tbl VALUES ( '(1000,0,0,1000)' ); +ERROR: relation "gpolygon_tbl" does not exist +LINE 1: INSERT INTO gpolygon_tbl VALUES ( '(1000,0,0,1000)' ); + ^ +INSERT INTO gpolygon_tbl VALUES ( '(0,1000,1000,1000)' ); +ERROR: relation "gpolygon_tbl" does not exist +LINE 1: INSERT INTO gpolygon_tbl VALUES ( '(0,1000,1000,1000)' ); + ^ +CREATE TEMP TABLE gcircle_tbl AS + SELECT circle(home_base) AS f1 FROM slow_emp4000; +ERROR: INTO clause not yet supported +CREATE INDEX ggpolygonind ON gpolygon_tbl USING gist (f1); +ERROR: relation "gpolygon_tbl" does not exist +CREATE INDEX ggcircleind ON gcircle_tbl USING gist (f1); +ERROR: relation "gcircle_tbl" does not exist +SET enable_seqscan = ON; +SET enable_indexscan = OFF; +SET enable_bitmapscan = OFF; +SELECT * FROM fast_emp4000 + WHERE home_base @ '(200,200),(2000,1000)'::box + ORDER BY (home_base[0])[0]; + home_base +----------- +(0 rows) + +SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box; + count +------- + 1 +(1 row) + +SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL; + count +------- + 138 +(1 row) + +SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon + ORDER BY (poly_center(f1))[0]; + id | f1 +----+--------------------- + 1 | ((2,0),(2,4),(0,0)) +(1 row) + +SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1) + ORDER BY area(f1); + f1 +--------------- + <(1,2),3> + <(1,3),5> + <(1,2),100> + <(100,1),115> +(4 rows) + +SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,0)'::polygon; +ERROR: relation "gpolygon_tbl" does not exist +LINE 1: SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,... + ^ +SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500>'::circle; +ERROR: relation "gcircle_tbl" does not exist +LINE 1: SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500... + ^ +SELECT count(*) FROM point_tbl WHERE f1 <@ box '(0,0,100,100)'; + count +------- + 3 +(1 row) + +SELECT count(*) FROM point_tbl WHERE box '(0,0,100,100)' @> f1; + count +------- + 3 +(1 row) + +SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,50),(100,0),(0,0)'; + count +------- + 3 +(1 row) + +SELECT count(*) FROM point_tbl WHERE f1 <@ circle '<(50,50),50>'; + count +------- + 1 +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 << '(0.0, 0.0)'; + count +------- + 3 +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; + count +------- + 2 +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; + count +------- + 1 +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; + count +------- + 3 +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)'; + count +------- + 1 +(1 row) + +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = ON; +EXPLAIN (COSTS OFF) +SELECT * FROM fast_emp4000 + WHERE home_base @ '(200,200),(2000,1000)'::box + ORDER BY (home_base[0])[0]; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT * FROM fast_emp4000 + WHERE home_base @ '(200,200),(2000,1000)'::box + ORDER BY (home_base[0])[0]; + home_base +----------- +(0 rows) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM fast_emp4000 WHERE home_base && '(1000,1000,0,0)'::box; + count +------- + 1 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM fast_emp4000 WHERE home_base IS NULL; + count +------- + 138 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon + ORDER BY (poly_center(f1))[0]; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT * FROM polygon_tbl WHERE f1 ~ '((1,1),(2,2),(2,1))'::polygon + ORDER BY (poly_center(f1))[0]; + id | f1 +----+--------------------- + 1 | ((2,0),(2,4),(0,0)) +(1 row) + +EXPLAIN (COSTS OFF) +SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1) + ORDER BY area(f1); + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1) + ORDER BY area(f1); + f1 +--------------- + <(1,2),3> + <(1,3),5> + <(1,2),100> + <(100,1),115> +(4 rows) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,0)'::polygon; +ERROR: relation "gpolygon_tbl" does not exist +LINE 2: SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,... + ^ +SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,0)'::polygon; +ERROR: relation "gpolygon_tbl" does not exist +LINE 1: SELECT count(*) FROM gpolygon_tbl WHERE f1 && '(1000,1000,0,... + ^ +EXPLAIN (COSTS OFF) +SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500>'::circle; +ERROR: relation "gcircle_tbl" does not exist +LINE 2: SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500... + ^ +SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500>'::circle; +ERROR: relation "gcircle_tbl" does not exist +LINE 1: SELECT count(*) FROM gcircle_tbl WHERE f1 && '<(500,500),500... + ^ +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl WHERE f1 <@ box '(0,0,100,100)'; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl WHERE f1 <@ box '(0,0,100,100)'; + count +------- + 3 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl WHERE box '(0,0,100,100)' @> f1; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl WHERE box '(0,0,100,100)' @> f1; + count +------- + 3 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,50),(100,0),(0,0)'; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,50),(100,0),(0,0)'; + count +------- + 3 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl WHERE f1 <@ circle '<(50,50),50>'; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl WHERE f1 <@ circle '<(50,50),50>'; + count +------- + 1 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 << '(0.0, 0.0)'; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 << '(0.0, 0.0)'; + count +------- + 3 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)'; + count +------- + 2 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)'; + count +------- + 1 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)'; + count +------- + 3 +(1 row) + +EXPLAIN (COSTS OFF) +SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)'; + QUERY PLAN +---------------- + Data Node Scan +(1 row) + +SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)'; + count +------- + 1 +(1 row) + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; +-- +-- GIN over int[] and text[] +-- +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = OFF; +CREATE INDEX intarrayidx ON array_index_op_test USING gin (i); +SELECT * FROM array_index_op_test WHERE i @> '{32}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(6 rows) + +SELECT * FROM array_index_op_test WHERE i && '{32}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(6 rows) + +SELECT * FROM array_index_op_test WHERE i @> '{17}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 12 | {17,99,18,52,91,72,0,43,96,23} | {AAAAA33250,AAAAAAAAAAAAAAAAAAA85420,AAAAAAAAAAA33576} + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 53 | {38,17} | {AAAAAAAAAAA21658} + 65 | {61,5,76,59,17} | {AAAAAA99807,AAAAA64741,AAAAAAAAAAA53908,AA21643,AAAAAAAAA10012} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} +(8 rows) + +SELECT * FROM array_index_op_test WHERE i && '{17}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 12 | {17,99,18,52,91,72,0,43,96,23} | {AAAAA33250,AAAAAAAAAAAAAAAAAAA85420,AAAAAAAAAAA33576} + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 53 | {38,17} | {AAAAAAAAAAA21658} + 65 | {61,5,76,59,17} | {AAAAAA99807,AAAAA64741,AAAAAAAAAAA53908,AA21643,AAAAAAAAA10012} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} +(8 rows) + +SELECT * FROM array_index_op_test WHERE i @> '{32,17}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} +(3 rows) + +SELECT * FROM array_index_op_test WHERE i && '{32,17}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 12 | {17,99,18,52,91,72,0,43,96,23} | {AAAAA33250,AAAAAAAAAAAAAAAAAAA85420,AAAAAAAAAAA33576} + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 53 | {38,17} | {AAAAAAAAAAA21658} + 65 | {61,5,76,59,17} | {AAAAAA99807,AAAAA64741,AAAAAAAAAAA53908,AA21643,AAAAAAAAA10012} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(11 rows) + +SELECT * FROM array_index_op_test WHERE i <@ '{38,34,32,89}' ORDER BY seqno; + seqno | i | t +-------+---------------+---------------------------------------------------------------------------------------------------------------------------- + 40 | {34} | {AAAAAAAAAAAAAA10611,AAAAAAAAAAAAAAAAAAA1205,AAAAAAAAAAA50956,AAAAAAAAAAAAAAAA31334,AAAAA70466,AAAAAAAA81587,AAAAAAA74623} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} +(3 rows) + +SELECT * FROM array_index_op_test WHERE i = '{47,77}' ORDER BY seqno; + seqno | i | t +-------+---------+----------------------------------------------------------------------------------------------------------------- + 95 | {47,77} | {AAAAAAAAAAAAAAAAA764,AAAAAAAAAAA74076,AAAAAAAAAA18107,AAAAA40681,AAAAAAAAAAAAAAA35875,AAAAA60038,AAAAAAA56483} +(1 row) + +CREATE INDEX textarrayidx ON array_index_op_test USING gin (t); +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAAA72908}' ORDER BY seqno; + seqno | i | t +-------+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------- + 22 | {11,6,56,62,53,30} | {AAAAAAAA72908} + 45 | {99,45} | {AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611} + 72 | {22,1,16,78,20,91,83} | {47735,AAAAAAA56483,AAAAAAAAAAAAA93788,AA42406,AAAAAAAAAAAAA73084,AAAAAAAA72908,AAAAAAAAAAAAAAAAAA61286,AAAAA66674,AAAAAAAAAAAAAAAAA50407} + 79 | {45} | {AAAAAAAAAA646,AAAAAAAAAAAAAAAAAAA70415,AAAAAA43678,AAAAAAAA72908} +(4 rows) + +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAAA72908}' ORDER BY seqno; + seqno | i | t +-------+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------- + 22 | {11,6,56,62,53,30} | {AAAAAAAA72908} + 45 | {99,45} | {AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611} + 72 | {22,1,16,78,20,91,83} | {47735,AAAAAAA56483,AAAAAAAAAAAAA93788,AA42406,AAAAAAAAAAAAA73084,AAAAAAAA72908,AAAAAAAAAAAAAAAAAA61286,AAAAA66674,AAAAAAAAAAAAAAAAA50407} + 79 | {45} | {AAAAAAAAAA646,AAAAAAAAAAAAAAAAAAA70415,AAAAAA43678,AAAAAAAA72908} +(4 rows) + +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAAAAA646}' ORDER BY seqno; + seqno | i | t +-------+------------------+-------------------------------------------------------------------- + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 79 | {45} | {AAAAAAAAAA646,AAAAAAAAAAAAAAAAAAA70415,AAAAAA43678,AAAAAAAA72908} + 96 | {23,97,43} | {AAAAAAAAAA646,A87088} +(3 rows) + +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAAAAA646}' ORDER BY seqno; + seqno | i | t +-------+------------------+-------------------------------------------------------------------- + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 79 | {45} | {AAAAAAAAAA646,AAAAAAAAAAAAAAAAAAA70415,AAAAAA43678,AAAAAAAA72908} + 96 | {23,97,43} | {AAAAAAAAAA646,A87088} +(3 rows) + +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; + seqno | i | t +-------+------+-------------------------------------------------------------------- + 79 | {45} | {AAAAAAAAAA646,AAAAAAAAAAAAAAAAAAA70415,AAAAAA43678,AAAAAAAA72908} +(1 row) + +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAAA72908,AAAAAAAAAA646}' ORDER BY seqno; + seqno | i | t +-------+-----------------------+-------------------------------------------------------------------------------------------------------------------------------------------- + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 22 | {11,6,56,62,53,30} | {AAAAAAAA72908} + 45 | {99,45} | {AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611} + 72 | {22,1,16,78,20,91,83} | {47735,AAAAAAA56483,AAAAAAAAAAAAA93788,AA42406,AAAAAAAAAAAAA73084,AAAAAAAA72908,AAAAAAAAAAAAAAAAAA61286,AAAAA66674,AAAAAAAAAAAAAAAAA50407} + 79 | {45} | {AAAAAAAAAA646,AAAAAAAAAAAAAAAAAAA70415,AAAAAA43678,AAAAAAAA72908} + 96 | {23,97,43} | {AAAAAAAAAA646,A87088} +(6 rows) + +SELECT * FROM array_index_op_test WHERE t <@ '{AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611}' ORDER BY seqno; + seqno | i | t +-------+--------------------+----------------------------------------------------------------------------------------------------------- + 22 | {11,6,56,62,53,30} | {AAAAAAAA72908} + 45 | {99,45} | {AAAAAAAA72908,AAAAAAAAAAAAAAAAAAA17075,AA88409,AAAAAAAAAAAAAAAAAA36842,AAAAAAA48038,AAAAAAAAAAAAAA10611} +(2 rows) + +SELECT * FROM array_index_op_test WHERE t = '{AAAAAAAAAA646,A87088}' ORDER BY seqno; + seqno | i | t +-------+------------+------------------------ + 96 | {23,97,43} | {AAAAAAAAAA646,A87088} +(1 row) + +-- Repeat some of the above tests but exercising bitmapscans instead +SET enable_indexscan = OFF; +SET enable_bitmapscan = ON; +SELECT * FROM array_index_op_test WHERE i @> '{32}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(6 rows) + +SELECT * FROM array_index_op_test WHERE i && '{32}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(6 rows) + +SELECT * FROM array_index_op_test WHERE i @> '{17}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 12 | {17,99,18,52,91,72,0,43,96,23} | {AAAAA33250,AAAAAAAAAAAAAAAAAAA85420,AAAAAAAAAAA33576} + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 53 | {38,17} | {AAAAAAAAAAA21658} + 65 | {61,5,76,59,17} | {AAAAAA99807,AAAAA64741,AAAAAAAAAAA53908,AA21643,AAAAAAAAA10012} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} +(8 rows) + +SELECT * FROM array_index_op_test WHERE i && '{17}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 12 | {17,99,18,52,91,72,0,43,96,23} | {AAAAA33250,AAAAAAAAAAAAAAAAAAA85420,AAAAAAAAAAA33576} + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 53 | {38,17} | {AAAAAAAAAAA21658} + 65 | {61,5,76,59,17} | {AAAAAA99807,AAAAA64741,AAAAAAAAAAA53908,AA21643,AAAAAAAAA10012} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} +(8 rows) + +SELECT * FROM array_index_op_test WHERE i @> '{32,17}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} +(3 rows) + +SELECT * FROM array_index_op_test WHERE i && '{32,17}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 12 | {17,99,18,52,91,72,0,43,96,23} | {AAAAA33250,AAAAAAAAAAAAAAAAAAA85420,AAAAAAAAAAA33576} + 15 | {17,14,16,63,67} | {AA6416,AAAAAAAAAA646,AAAAA95309} + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 53 | {38,17} | {AAAAAAAAAAA21658} + 65 | {61,5,76,59,17} | {AAAAAA99807,AAAAA64741,AAAAAAAAAAA53908,AA21643,AAAAAAAAA10012} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(11 rows) + +SELECT * FROM array_index_op_test WHERE i <@ '{38,34,32,89}' ORDER BY seqno; + seqno | i | t +-------+---------------+---------------------------------------------------------------------------------------------------------------------------- + 40 | {34} | {AAAAAAAAAAAAAA10611,AAAAAAAAAAAAAAAAAAA1205,AAAAAAAAAAA50956,AAAAAAAAAAAAAAAA31334,AAAAA70466,AAAAAAAA81587,AAAAAAA74623} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} +(3 rows) + +SELECT * FROM array_index_op_test WHERE i = '{47,77}' ORDER BY seqno; + seqno | i | t +-------+---------+----------------------------------------------------------------------------------------------------------------- + 95 | {47,77} | {AAAAAAAAAAAAAAAAA764,AAAAAAAAAAA74076,AAAAAAAAAA18107,AAAAA40681,AAAAAAAAAAAAAAA35875,AAAAA60038,AAAAAAA56483} +(1 row) + +-- And try it with a multicolumn GIN index +DROP INDEX intarrayidx, textarrayidx; +CREATE INDEX botharrayidx ON array_index_op_test USING gin (i, t); +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = OFF; +SELECT * FROM array_index_op_test WHERE i @> '{32}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(6 rows) + +SELECT * FROM array_index_op_test WHERE i && '{32}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(6 rows) + +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAA80240}' ORDER BY seqno; + seqno | i | t +-------+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------- + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 30 | {26,81,47,91,34} | {AAAAAAAAAAAAAAAAAAA70104,AAAAAAA80240} + 64 | {26,19,34,24,81,78} | {A96617,AAAAAAAAAAAAAAAAAAA70104,A68938,AAAAAAAAAAA53908,AAAAAAAAAAAAAAA453,AA17009,AAAAAAA80240} + 82 | {34,60,4,79,78,16,86,89,42,50} | {AAAAA40681,AAAAAAAAAAAAAAAAAA12591,AAAAAAA80240,AAAAAAAAAAAAAAAA55798,AAAAAAAAAAAAAAAAAAA70104} + 88 | {41,90,77,24,6,24} | {AAAA35194,AAAA35194,AAAAAAA80240,AAAAAAAAAAA46154,AAAAAA58494,AAAAAAAAAAAAAAAAAAA17075,AAAAAAAAAAAAAAAAAA59334,AAAAAAAAAAAAAAAAAAA91804,AA74433} + 97 | {54,2,86,65} | {47735,AAAAAAA99836,AAAAAAAAAAAAAAAAA6897,AAAAAAAAAAAAAAAA29150,AAAAAAA80240,AAAAAAAAAAAAAAAA98414,AAAAAAA56483,AAAAAAAAAAAAAAAA29150,AAAAAAA39692,AA21643} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(7 rows) + +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAA80240}' ORDER BY seqno; + seqno | i | t +-------+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------- + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 30 | {26,81,47,91,34} | {AAAAAAAAAAAAAAAAAAA70104,AAAAAAA80240} + 64 | {26,19,34,24,81,78} | {A96617,AAAAAAAAAAAAAAAAAAA70104,A68938,AAAAAAAAAAA53908,AAAAAAAAAAAAAAA453,AA17009,AAAAAAA80240} + 82 | {34,60,4,79,78,16,86,89,42,50} | {AAAAA40681,AAAAAAAAAAAAAAAAAA12591,AAAAAAA80240,AAAAAAAAAAAAAAAA55798,AAAAAAAAAAAAAAAAAAA70104} + 88 | {41,90,77,24,6,24} | {AAAA35194,AAAA35194,AAAAAAA80240,AAAAAAAAAAA46154,AAAAAA58494,AAAAAAAAAAAAAAAAAAA17075,AAAAAAAAAAAAAAAAAA59334,AAAAAAAAAAAAAAAAAAA91804,AA74433} + 97 | {54,2,86,65} | {47735,AAAAAAA99836,AAAAAAAAAAAAAAAAA6897,AAAAAAAAAAAAAAAA29150,AAAAAAA80240,AAAAAAAAAAAAAAAA98414,AAAAAAA56483,AAAAAAAAAAAAAAAA29150,AAAAAAA39692,AA21643} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(7 rows) + +SELECT * FROM array_index_op_test WHERE i @> '{32}' AND t && '{AAAAAAA80240}' ORDER BY seqno; + seqno | i | t +-------+-----------------------------+------------------------------------------------------------------------------ + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(1 row) + +SELECT * FROM array_index_op_test WHERE i && '{32}' AND t @> '{AAAAAAA80240}' ORDER BY seqno; + seqno | i | t +-------+-----------------------------+------------------------------------------------------------------------------ + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(1 row) + +SET enable_indexscan = OFF; +SET enable_bitmapscan = ON; +SELECT * FROM array_index_op_test WHERE i @> '{32}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(6 rows) + +SELECT * FROM array_index_op_test WHERE i && '{32}' ORDER BY seqno; + seqno | i | t +-------+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------ + 6 | {39,35,5,94,17,92,60,32} | {AAAAAAAAAAAAAAA35875,AAAAAAAAAAAAAAAA23657} + 74 | {32} | {AAAAAAAAAAAAAAAA1729,AAAAAAAAAAAAA22860,AAAAAA99807,AAAAA17383,AAAAAAAAAAAAAAA67062,AAAAAAAAAAA15165,AAAAAAAAAAA50956} + 77 | {97,15,32,17,55,59,18,37,50,39} | {AAAAAAAAAAAA67946,AAAAAA54032,AAAAAAAA81587,55847,AAAAAAAAAAAAAA28620,AAAAAAAAAAAAAAAAA43052,AAAAAA75463,AAAA49534,AAAAAAAA44066} + 89 | {40,32,17,6,30,88} | {AA44673,AAAAAAAAAAA6119,AAAAAAAAAAAAAAAA23657,AAAAAAAAAAAAAAAAAA47955,AAAAAAAAAAAAAAAA33598,AAAAAAAAAAA33576,AA44673} + 98 | {38,34,32,89} | {AAAAAAAAAAAAAAAAAA71621,AAAA8857,AAAAAAAAAAAAAAAAAAA65037,AAAAAAAAAAAAAAAA31334,AAAAAAAAAA48845} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(6 rows) + +SELECT * FROM array_index_op_test WHERE t @> '{AAAAAAA80240}' ORDER BY seqno; + seqno | i | t +-------+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------- + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 30 | {26,81,47,91,34} | {AAAAAAAAAAAAAAAAAAA70104,AAAAAAA80240} + 64 | {26,19,34,24,81,78} | {A96617,AAAAAAAAAAAAAAAAAAA70104,A68938,AAAAAAAAAAA53908,AAAAAAAAAAAAAAA453,AA17009,AAAAAAA80240} + 82 | {34,60,4,79,78,16,86,89,42,50} | {AAAAA40681,AAAAAAAAAAAAAAAAAA12591,AAAAAAA80240,AAAAAAAAAAAAAAAA55798,AAAAAAAAAAAAAAAAAAA70104} + 88 | {41,90,77,24,6,24} | {AAAA35194,AAAA35194,AAAAAAA80240,AAAAAAAAAAA46154,AAAAAA58494,AAAAAAAAAAAAAAAAAAA17075,AAAAAAAAAAAAAAAAAA59334,AAAAAAAAAAAAAAAAAAA91804,AA74433} + 97 | {54,2,86,65} | {47735,AAAAAAA99836,AAAAAAAAAAAAAAAAA6897,AAAAAAAAAAAAAAAA29150,AAAAAAA80240,AAAAAAAAAAAAAAAA98414,AAAAAAA56483,AAAAAAAAAAAAAAAA29150,AAAAAAA39692,AA21643} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(7 rows) + +SELECT * FROM array_index_op_test WHERE t && '{AAAAAAA80240}' ORDER BY seqno; + seqno | i | t +-------+--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------- + 19 | {52,82,17,74,23,46,69,51,75} | {AAAAAAAAAAAAA73084,AAAAA75968,AAAAAAAAAAAAAAAA14047,AAAAAAA80240,AAAAAAAAAAAAAAAAAAA1205,A68938} + 30 | {26,81,47,91,34} | {AAAAAAAAAAAAAAAAAAA70104,AAAAAAA80240} + 64 | {26,19,34,24,81,78} | {A96617,AAAAAAAAAAAAAAAAAAA70104,A68938,AAAAAAAAAAA53908,AAAAAAAAAAAAAAA453,AA17009,AAAAAAA80240} + 82 | {34,60,4,79,78,16,86,89,42,50} | {AAAAA40681,AAAAAAAAAAAAAAAAAA12591,AAAAAAA80240,AAAAAAAAAAAAAAAA55798,AAAAAAAAAAAAAAAAAAA70104} + 88 | {41,90,77,24,6,24} | {AAAA35194,AAAA35194,AAAAAAA80240,AAAAAAAAAAA46154,AAAAAA58494,AAAAAAAAAAAAAAAAAAA17075,AAAAAAAAAAAAAAAAAA59334,AAAAAAAAAAAAAAAAAAA91804,AA74433} + 97 | {54,2,86,65} | {47735,AAAAAAA99836,AAAAAAAAAAAAAAAAA6897,AAAAAAAAAAAAAAAA29150,AAAAAAA80240,AAAAAAAAAAAAAAAA98414,AAAAAAA56483,AAAAAAAAAAAAAAAA29150,AAAAAAA39692,AA21643} + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(7 rows) + +SELECT * FROM array_index_op_test WHERE i @> '{32}' AND t && '{AAAAAAA80240}' ORDER BY seqno; + seqno | i | t +-------+-----------------------------+------------------------------------------------------------------------------ + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(1 row) + +SELECT * FROM array_index_op_test WHERE i && '{32}' AND t @> '{AAAAAAA80240}' ORDER BY seqno; + seqno | i | t +-------+-----------------------------+------------------------------------------------------------------------------ + 100 | {85,32,57,39,49,84,32,3,30} | {AAAAAAA80240,AAAAAAAAAAAAAAAA1729,AAAAA60038,AAAAAAAAAAA92631,AAAAAAAA9523} +(1 row) + +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; +-- +-- HASH +-- +CREATE INDEX hash_i4_index ON hash_i4_heap USING hash (random int4_ops); +CREATE INDEX hash_name_index ON hash_name_heap USING hash (random name_ops); +CREATE INDEX hash_txt_index ON hash_txt_heap USING hash (random text_ops); +CREATE INDEX hash_f8_index ON hash_f8_heap USING hash (random float8_ops); +-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops); +-- +-- Test functional index +-- +CREATE TABLE func_index_heap (f1 text, f2 text); +CREATE UNIQUE INDEX func_index_index on func_index_heap (textcat(f1,f2)); +ERROR: Cannot locally enforce a unique index on round robin distributed table. +INSERT INTO func_index_heap VALUES('ABC','DEF'); +INSERT INTO func_index_heap VALUES('AB','CDEFG'); +INSERT INTO func_index_heap VALUES('QWE','RTY'); +-- this should fail because of unique index: +INSERT INTO func_index_heap VALUES('ABCD', 'EF'); +-- but this shouldn't: +INSERT INTO func_index_heap VALUES('QWERTY'); +-- +-- Same test, expressional index +-- +DROP TABLE func_index_heap; +CREATE TABLE func_index_heap (f1 text, f2 text); +CREATE UNIQUE INDEX func_index_index on func_index_heap ((f1 || f2) text_ops); +ERROR: Cannot locally enforce a unique index on round robin distributed table. +INSERT INTO func_index_heap VALUES('ABC','DEF'); +INSERT INTO func_index_heap VALUES('AB','CDEFG'); +INSERT INTO func_index_heap VALUES('QWE','RTY'); +-- this should fail because of unique index: +INSERT INTO func_index_heap VALUES('ABCD', 'EF'); +-- but this shouldn't: +INSERT INTO func_index_heap VALUES('QWERTY'); +-- +-- Also try building functional, expressional, and partial indexes on +-- tables that already contain data. +-- +create unique index hash_f8_index_1 on hash_f8_heap(abs(random)); +ERROR: Unique index of partitioned table must contain the hash/modulo distribution column. +create unique index hash_f8_index_2 on hash_f8_heap((seqno + 1), random); +ERROR: Unique index of partitioned table must contain the hash/modulo distribution column. +create unique index hash_f8_index_3 on hash_f8_heap(random) where seqno > 1000; +ERROR: Unique index of partitioned table must contain the hash/modulo distribution column. +-- +-- Try some concurrent index builds +-- +-- Unfortunately this only tests about half the code paths because there are +-- no concurrent updates happening to the table at the same time. +CREATE TABLE concur_heap (f1 text, f2 text); +-- empty table +CREATE INDEX CONCURRENTLY concur_index1 ON concur_heap(f2,f1); +ERROR: PGXC does not support concurrent INDEX yet +DETAIL: The feature is not currently supported +INSERT INTO concur_heap VALUES ('a','b'); +INSERT INTO concur_heap VALUES ('b','b'); +-- unique index +CREATE UNIQUE INDEX CONCURRENTLY concur_index2 ON concur_heap(f1); +ERROR: PGXC does not support concurrent INDEX yet +DETAIL: The feature is not currently supported +-- check if constraint is set up properly to be enforced +INSERT INTO concur_heap VALUES ('b','x'); +-- check if constraint is enforced properly at build time +CREATE UNIQUE INDEX CONCURRENTLY concur_index3 ON concur_heap(f2); +ERROR: PGXC does not support concurrent INDEX yet +DETAIL: The feature is not currently supported +-- test that expression indexes and partial indexes work concurrently +CREATE INDEX CONCURRENTLY concur_index4 on concur_heap(f2) WHERE f1='a'; +ERROR: PGXC does not support concurrent INDEX yet +DETAIL: The feature is not currently supported +CREATE INDEX CONCURRENTLY concur_index5 on concur_heap(f2) WHERE f1='x'; +ERROR: PGXC does not support concurrent INDEX yet +DETAIL: The feature is not currently supported +-- here we also check that you can default the index name +CREATE INDEX CONCURRENTLY on concur_heap((f2||f1)); +ERROR: PGXC does not support concurrent INDEX yet +DETAIL: The feature is not currently supported +-- You can't do a concurrent index build in a transaction +BEGIN; +CREATE INDEX CONCURRENTLY concur_index7 ON concur_heap(f1); +ERROR: PGXC does not support concurrent INDEX yet +DETAIL: The feature is not currently supported +COMMIT; +-- But you can do a regular index build in a transaction +BEGIN; +CREATE INDEX std_index on concur_heap(f2); +COMMIT; +-- check to make sure that the failed indexes were cleaned up properly and the +-- successful indexes are created properly. Notably that they do NOT have the +-- "invalid" flag set. +\d concur_heap +Table "public.concur_heap" + Column | Type | Modifiers +--------+------+----------- + f1 | text | + f2 | text | +Indexes: + "std_index" btree (f2) + +DROP TABLE concur_heap; +-- +-- Tests for IS NULL/IS NOT NULL with b-tree indexes +-- +SELECT unique1, unique2 INTO onek_with_null FROM onek; +ERROR: INTO clause not yet supported +INSERT INTO onek_with_null (unique1,unique2) VALUES (NULL, -1), (NULL, NULL); +ERROR: relation "onek_with_null" does not exist +LINE 1: INSERT INTO onek_with_null (unique1,unique2) VALUES (NULL, -... + ^ +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2,unique1); +ERROR: relation "onek_with_null" does not exist +SET enable_seqscan = OFF; +SET enable_indexscan = ON; +SET enable_bitmapscan = ON; +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AN... + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NUL... + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NOT NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AN... + ^ +DROP INDEX onek_nulltest; +ERROR: index "onek_nulltest" does not exist +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2 desc,unique1); +ERROR: relation "onek_with_null" does not exist +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AN... + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NUL... + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NOT NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AN... + ^ +DROP INDEX onek_nulltest; +ERROR: index "onek_nulltest" does not exist +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2 desc nulls last,unique1); +ERROR: relation "onek_with_null" does not exist +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AN... + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NUL... + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NOT NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AN... + ^ +DROP INDEX onek_nulltest; +ERROR: index "onek_nulltest" does not exist +CREATE UNIQUE INDEX onek_nulltest ON onek_with_null (unique2 nulls first,unique1); +ERROR: relation "onek_with_null" does not exist +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL; + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AN... + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NOT NUL... + ^ +SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AND unique2 IS NOT NULL; +ERROR: relation "onek_with_null" does not exist +LINE 1: SELECT count(*) FROM onek_with_null WHERE unique1 IS NULL AN... + ^ +RESET enable_seqscan; +RESET enable_indexscan; +RESET enable_bitmapscan; + +DROP TABLE onek_with_null; +ERROR: table "onek_with_null" does not exist ----------------------------------------------------------------------- Summary of changes: .../{create_index.out => create_index_1.out} | 428 +++++++++----------- 1 files changed, 182 insertions(+), 246 deletions(-) copy src/test/regress/expected/{create_index.out => create_index_1.out} (88%) hooks/post-receive -- Postgres-XC |
From: Michael P. <mic...@us...> - 2011-04-08 08:54:42
|
Project "Postgres-XC". The branch, master has been updated via 9a329381083f831459db12cdd6616552c4571c5b (commit) from 7ebac29189aaa205c18e21580ef88f98ac262c43 (commit) - Log ----------------------------------------------------------------- commit 9a329381083f831459db12cdd6616552c4571c5b Author: Michael P <mic...@us...> Date: Fri Apr 8 17:49:52 2011 +0900 Change license of Postgres-XC to BSD License of versions 0.9 to 0.9.3 was LGPL. diff --git a/COPYRIGHT b/COPYRIGHT index b773b4d..18259d0 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,6 +1,6 @@ -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) +Postgres-XC Cluster Database Management System +Portions Copyright (c) 2010-2011, Nippon Telegraph and Telephone Corporation Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group Portions Copyright (c) 1994, The Regents of the University of California @@ -21,3 +21,15 @@ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + +IN NO EVENT SHALL POSTGRESQL GLOBAL DEVELOPMENT GROUP BE LIABLE TO ANY +PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS +SOFTWARE AND ITS DOCUMENTATION, EVEN IF POSTGRESQL GLOBAL DEVELOPMENT +GROUP HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +POSTGRESQL GLOBAL DEVELOPMENT GROUP SPECIFICALLY DISCLAIMS ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE POSTGRESQL GLOBAL DEVELOPMENT GROUP HAS NO OBLIGATIONS TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. ----------------------------------------------------------------------- Summary of changes: COPYRIGHT | 16 ++++++++++++++-- 1 files changed, 14 insertions(+), 2 deletions(-) hooks/post-receive -- Postgres-XC |
From: Michael P. <mic...@us...> - 2011-04-08 08:34:15
|
Project "Postgres-XC". The branch, master has been updated via 7ebac29189aaa205c18e21580ef88f98ac262c43 (commit) from 0fd3d4109912f1685bbd8ee657df2e92a4ec69f7 (commit) - Log ----------------------------------------------------------------- commit 7ebac29189aaa205c18e21580ef88f98ac262c43 Author: Michael P <mic...@us...> Date: Fri Apr 8 17:28:38 2011 +0900 Fix for regression test constraints Non-immutable functions used as DEFAULT and DEFERRED constraints, are not supported, so this output is OK. A couple of ORDER BY have been added to have constant results whatever the cluster configuration. diff --git a/src/test/regress/input/constraints.source b/src/test/regress/input/constraints.source index 7474d3e..9b3c514 100644 --- a/src/test/regress/input/constraints.source +++ b/src/test/regress/input/constraints.source @@ -282,7 +282,7 @@ ROLLBACK; -- check is done at end of statement, so this should succeed UPDATE unique_tbl SET i = i+1; -SELECT * FROM unique_tbl; +SELECT * FROM unique_tbl ORDER BY 1,t; -- explicitly defer the constraint BEGIN; @@ -294,7 +294,7 @@ DELETE FROM unique_tbl WHERE t = 'tree'; -- makes constraint valid again COMMIT; -- should succeed -SELECT * FROM unique_tbl; +SELECT * FROM unique_tbl ORDER BY 1,t; -- try adding an initially deferred constraint ALTER TABLE unique_tbl DROP CONSTRAINT unique_tbl_i_key; @@ -312,7 +312,7 @@ DELETE FROM unique_tbl WHERE i = 5 AND t = 'five'; COMMIT; -SELECT * FROM unique_tbl; +SELECT * FROM unique_tbl ORDER BY 1,t; -- should fail at commit-time BEGIN; @@ -349,7 +349,7 @@ UPDATE unique_tbl SET t = 'THREE' WHERE i = 3 AND t = 'Three'; COMMIT; -- should fail -SELECT * FROM unique_tbl; +SELECT * FROM unique_tbl ORDER BY 1,t; -- test a HOT update that modifies the newly inserted tuple, -- but should succeed because we then remove the other conflicting tuple. @@ -360,11 +360,11 @@ INSERT INTO unique_tbl VALUES(3, 'tree'); -- should succeed for now UPDATE unique_tbl SET t = 'threex' WHERE t = 'tree'; DELETE FROM unique_tbl WHERE t = 'three'; -SELECT * FROM unique_tbl; +SELECT * FROM unique_tbl ORDER BY 1,t; COMMIT; -SELECT * FROM unique_tbl; +SELECT * FROM unique_tbl ORDER BY 1,t; DROP TABLE unique_tbl; diff --git a/src/test/regress/output/constraints_1.source b/src/test/regress/output/constraints_1.source new file mode 100644 index 0000000..77e440d --- /dev/null +++ b/src/test/regress/output/constraints_1.source @@ -0,0 +1,646 @@ +-- +-- CONSTRAINTS +-- Constraints can be specified with: +-- - DEFAULT clause +-- - CHECK clauses +-- - PRIMARY KEY clauses +-- - UNIQUE clauses +-- - EXCLUDE clauses +-- +-- +-- DEFAULT syntax +-- +CREATE TABLE DEFAULT_TBL (i int DEFAULT 100, + x text DEFAULT 'vadim', f float8 DEFAULT 123.456); +INSERT INTO DEFAULT_TBL VALUES (1, 'thomas', 57.0613); +INSERT INTO DEFAULT_TBL VALUES (1, 'bruce'); +INSERT INTO DEFAULT_TBL (i, f) VALUES (2, 987.654); +INSERT INTO DEFAULT_TBL (x) VALUES ('marc'); +INSERT INTO DEFAULT_TBL VALUES (3, null, 1.0); +SELECT '' AS five, * FROM DEFAULT_TBL ORDER BY i,x,f; + five | i | x | f +------+-----+--------+--------- + | 1 | bruce | 123.456 + | 1 | thomas | 57.0613 + | 2 | vadim | 987.654 + | 3 | | 1 + | 100 | marc | 123.456 +(5 rows) + +CREATE SEQUENCE DEFAULT_SEQ; +CREATE TABLE DEFAULTEXPR_TBL (i1 int DEFAULT 100 + (200-199) * 2, + i2 int DEFAULT nextval('default_seq')); +ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet +DETAIL: The feature is not currently supported +INSERT INTO DEFAULTEXPR_TBL VALUES (-1, -2); +ERROR: relation "defaultexpr_tbl" does not exist +LINE 1: INSERT INTO DEFAULTEXPR_TBL VALUES (-1, -2); + ^ +INSERT INTO DEFAULTEXPR_TBL (i1) VALUES (-3); +ERROR: relation "defaultexpr_tbl" does not exist +LINE 1: INSERT INTO DEFAULTEXPR_TBL (i1) VALUES (-3); + ^ +INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (-4); +ERROR: relation "defaultexpr_tbl" does not exist +LINE 1: INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (-4); + ^ +INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (NULL); +ERROR: relation "defaultexpr_tbl" does not exist +LINE 1: INSERT INTO DEFAULTEXPR_TBL (i2) VALUES (NULL); + ^ +SELECT '' AS four, * FROM DEFAULTEXPR_TBL ORDER BY i1,i2; +ERROR: relation "defaultexpr_tbl" does not exist +LINE 1: SELECT '' AS four, * FROM DEFAULTEXPR_TBL ORDER BY i1,i2; + ^ +-- syntax errors +-- test for extraneous comma +CREATE TABLE error_tbl (i int DEFAULT (100, )); +ERROR: syntax error at or near ")" +LINE 1: CREATE TABLE error_tbl (i int DEFAULT (100, )); + ^ +-- this will fail because gram.y uses b_expr not a_expr for defaults, +-- to avoid a shift/reduce conflict that arises from NOT NULL being +-- part of the column definition syntax: +CREATE TABLE error_tbl (b1 bool DEFAULT 1 IN (1, 2)); +ERROR: syntax error at or near "IN" +LINE 1: CREATE TABLE error_tbl (b1 bool DEFAULT 1 IN (1, 2)); + ^ +-- this should work, however: +CREATE TABLE error_tbl (b1 bool DEFAULT (1 IN (1, 2))); +DROP TABLE error_tbl; +-- +-- CHECK syntax +-- +CREATE TABLE CHECK_TBL (x int, + CONSTRAINT CHECK_CON CHECK (x > 3)); +INSERT INTO CHECK_TBL VALUES (5); +INSERT INTO CHECK_TBL VALUES (4); +INSERT INTO CHECK_TBL VALUES (3); +ERROR: new row for relation "check_tbl" violates check constraint "check_con" +INSERT INTO CHECK_TBL VALUES (2); +ERROR: new row for relation "check_tbl" violates check constraint "check_con" +INSERT INTO CHECK_TBL VALUES (6); +INSERT INTO CHECK_TBL VALUES (1); +ERROR: new row for relation "check_tbl" violates check constraint "check_con" +SELECT '' AS three, * FROM CHECK_TBL ORDER BY x; + three | x +-------+--- + | 4 + | 5 + | 6 +(3 rows) + +CREATE SEQUENCE CHECK_SEQ; +CREATE TABLE CHECK2_TBL (x int, y text, z int, + CONSTRAINT SEQUENCE_CON + CHECK (x > 3 and y <> 'check failed' and z < 8)); +INSERT INTO CHECK2_TBL VALUES (4, 'check ok', -2); +INSERT INTO CHECK2_TBL VALUES (1, 'x check failed', -2); +ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" +INSERT INTO CHECK2_TBL VALUES (5, 'z check failed', 10); +ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" +INSERT INTO CHECK2_TBL VALUES (0, 'check failed', -2); +ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" +INSERT INTO CHECK2_TBL VALUES (6, 'check failed', 11); +ERROR: new row for relation "check2_tbl" violates check constraint "sequence_con" +INSERT INTO CHECK2_TBL VALUES (7, 'check ok', 7); +SELECT '' AS two, * from CHECK2_TBL ORDER BY x,y,z; + two | x | y | z +-----+---+----------+---- + | 4 | check ok | -2 + | 7 | check ok | 7 +(2 rows) + +-- +-- Check constraints on INSERT +-- +CREATE SEQUENCE INSERT_SEQ; +CREATE TABLE INSERT_TBL (x INT DEFAULT nextval('insert_seq'), + y TEXT DEFAULT '-NULL-', + z INT DEFAULT -1 * currval('insert_seq'), + CONSTRAINT INSERT_CON CHECK (x >= 3 AND y <> 'check failed' AND x < 8), + CHECK (x + z = 0)); +ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet +DETAIL: The feature is not currently supported +INSERT INTO INSERT_TBL(x,z) VALUES (2, -2); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(x,z) VALUES (2, -2); + ^ +SELECT '' AS zero, * FROM INSERT_TBL order by x,y,z; +ERROR: relation "insert_tbl" does not exist +LINE 1: SELECT '' AS zero, * FROM INSERT_TBL order by x,y,z; + ^ +SELECT 'one' AS one, nextval('insert_seq'); + one | nextval +-----+--------- + one | 1 +(1 row) + +INSERT INTO INSERT_TBL(y) VALUES ('Y'); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('Y'); + ^ +INSERT INTO INSERT_TBL(y) VALUES ('Y'); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('Y'); + ^ +INSERT INTO INSERT_TBL(x,z) VALUES (1, -2); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(x,z) VALUES (1, -2); + ^ +INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(z,x) VALUES (-7, 7); + ^ +INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL VALUES (5, 'check failed', -5); + ^ +INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL VALUES (7, '!check failed', -7); + ^ +INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); + ^ +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; +ERROR: relation "insert_tbl" does not exist +LINE 1: SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; + ^ +INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y,z) VALUES ('check failed', 4); + ^ +INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed'); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(x,y) VALUES (5, 'check failed'); + ^ +INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed'); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(x,y) VALUES (5, '!check failed'); + ^ +INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('-!NULL-'); + ^ +SELECT '' AS six, * FROM INSERT_TBL order by x,y,z; +ERROR: relation "insert_tbl" does not exist +LINE 1: SELECT '' AS six, * FROM INSERT_TBL order by x,y,z; + ^ +SELECT 'seven' AS one, nextval('insert_seq'); + one | nextval +-------+--------- + seven | 2 +(1 row) + +INSERT INTO INSERT_TBL(y) VALUES ('Y'); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y) VALUES ('Y'); + ^ +SELECT 'eight' AS one, currval('insert_seq'); + one | currval +-------+--------- + eight | 2 +(1 row) + +-- According to SQL92, it is OK to insert a record that gives rise to NULL +-- constraint-condition results. Postgres used to reject this, but it +-- was wrong: +INSERT INTO INSERT_TBL VALUES (null, null, null); +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL VALUES (null, null, null); + ^ +SELECT '' AS nine, * FROM INSERT_TBL order by x,y,z; +ERROR: relation "insert_tbl" does not exist +LINE 1: SELECT '' AS nine, * FROM INSERT_TBL order by x,y,z; + ^ +-- +-- Check inheritance of defaults and constraints +-- +CREATE TABLE INSERT_CHILD (cx INT default 42, + cy INT CHECK (cy > x)) + INHERITS (INSERT_TBL); +ERROR: relation "insert_tbl" does not exist +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11); +ERROR: relation "insert_child" does not exist +LINE 1: INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,11); + ^ +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6); +ERROR: relation "insert_child" does not exist +LINE 1: INSERT INTO INSERT_CHILD(x,z,cy) VALUES (7,-7,6); + ^ +INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7); +ERROR: relation "insert_child" does not exist +LINE 1: INSERT INTO INSERT_CHILD(x,z,cy) VALUES (6,-7,7); + ^ +INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',-6,7); +ERROR: relation "insert_child" does not exist +LINE 1: INSERT INTO INSERT_CHILD(x,y,z,cy) VALUES (6,'check failed',... + ^ +SELECT * FROM INSERT_CHILD order by 1,2,3; +ERROR: relation "insert_child" does not exist +LINE 1: SELECT * FROM INSERT_CHILD order by 1,2,3; + ^ +DROP TABLE INSERT_CHILD; +ERROR: table "insert_child" does not exist +-- +-- Check constraints on INSERT INTO +-- +DELETE FROM INSERT_TBL; +ERROR: relation "insert_tbl" does not exist +LINE 1: DELETE FROM INSERT_TBL; + ^ +ALTER SEQUENCE INSERT_SEQ RESTART WITH 4; +CREATE TABLE tmp (xd INT, yd TEXT, zd INT); +INSERT INTO tmp VALUES (null, 'Y', null); +INSERT INTO tmp VALUES (5, '!check failed', null); +INSERT INTO tmp VALUES (null, 'try again', null); +INSERT INTO INSERT_TBL(y) select yd from tmp; +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y) select yd from tmp; + ^ +SELECT '' AS three, * FROM INSERT_TBL order by x,y,z; +ERROR: relation "insert_tbl" does not exist +LINE 1: SELECT '' AS three, * FROM INSERT_TBL order by x,y,z; + ^ +INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try again'; +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL SELECT * FROM tmp WHERE yd = 'try aga... + ^ +INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd = 'try again'; +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y,z) SELECT yd, -7 FROM tmp WHERE yd ... + ^ +INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd = 'try again'; +ERROR: relation "insert_tbl" does not exist +LINE 1: INSERT INTO INSERT_TBL(y,z) SELECT yd, -8 FROM tmp WHERE yd ... + ^ +SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; +ERROR: relation "insert_tbl" does not exist +LINE 1: SELECT '' AS four, * FROM INSERT_TBL order by x,y,z; + ^ +DROP TABLE tmp; +-- +-- Check constraints on UPDATE +-- +UPDATE INSERT_TBL SET x = NULL WHERE x = 5; +ERROR: relation "insert_tbl" does not exist +LINE 1: UPDATE INSERT_TBL SET x = NULL WHERE x = 5; + ^ +UPDATE INSERT_TBL SET x = 6 WHERE x = 6; +ERROR: relation "insert_tbl" does not exist +LINE 1: UPDATE INSERT_TBL SET x = 6 WHERE x = 6; + ^ +UPDATE INSERT_TBL SET x = -z, z = -x; +ERROR: relation "insert_tbl" does not exist +LINE 1: UPDATE INSERT_TBL SET x = -z, z = -x; + ^ +UPDATE INSERT_TBL SET x = z, z = x; +ERROR: relation "insert_tbl" does not exist +LINE 1: UPDATE INSERT_TBL SET x = z, z = x; + ^ +SELECT * FROM INSERT_TBL order by x,y,z; +ERROR: relation "insert_tbl" does not exist +LINE 1: SELECT * FROM INSERT_TBL order by x,y,z; + ^ +-- DROP TABLE INSERT_TBL; +-- +-- Check constraints on COPY FROM +-- +CREATE TABLE COPY_TBL (x INT, y TEXT, z INT, + CONSTRAINT COPY_CON + CHECK (x > 3 AND y <> 'check failed' AND x < 7 )); +COPY COPY_TBL FROM '@abs_srcdir@/data/constro.data'; +SELECT '' AS two, * FROM COPY_TBL order by x,y,z; + two | x | y | z +-----+---+---------------+--- + | 4 | !check failed | 5 + | 6 | OK | 4 +(2 rows) + +COPY COPY_TBL FROM '@abs_srcdir@/data/constrf.data'; +ERROR: Error while running COPY +SELECT * FROM COPY_TBL order by x,y,z; + x | y | z +---+---------------+--- + 4 | !check failed | 5 + 6 | OK | 4 +(2 rows) + +-- +-- Primary keys +-- +CREATE TABLE PRIMARY_TBL (i int PRIMARY KEY, t text); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "primary_tbl_pkey" for table "primary_tbl" +INSERT INTO PRIMARY_TBL VALUES (1, 'one'); +INSERT INTO PRIMARY_TBL VALUES (2, 'two'); +INSERT INTO PRIMARY_TBL VALUES (1, 'three'); +ERROR: duplicate key value violates unique constraint "primary_tbl_pkey" +DETAIL: Key (i)=(1) already exists. +INSERT INTO PRIMARY_TBL VALUES (4, 'three'); +INSERT INTO PRIMARY_TBL VALUES (5, 'one'); +INSERT INTO PRIMARY_TBL (t) VALUES ('six'); +ERROR: null value in column "i" violates not-null constraint +SELECT '' AS four, * FROM PRIMARY_TBL order by i,t; + four | i | t +------+---+------- + | 1 | one + | 2 | two + | 4 | three + | 5 | one +(4 rows) + +DROP TABLE PRIMARY_TBL; +CREATE TABLE PRIMARY_TBL (i int, t text, + PRIMARY KEY(i,t)); +NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "primary_tbl_pkey" for table "primary_tbl" +INSERT INTO PRIMARY_TBL VALUES (1, 'one'); +INSERT INTO PRIMARY_TBL VALUES (2, 'two'); +INSERT INTO PRIMARY_TBL VALUES (1, 'three'); +INSERT INTO PRIMARY_TBL VALUES (4, 'three'); +INSERT INTO PRIMARY_TBL VALUES (5, 'one'); +INSERT INTO PRIMARY_TBL (t) VALUES ('six'); +ERROR: null value in column "i" violates not-null constraint +SELECT '' AS three, * FROM PRIMARY_TBL order by i,t; + three | i | t +-------+---+------- + | 1 | one + | 1 | three + | 2 | two + | 4 | three + | 5 | one +(5 rows) + +DROP TABLE PRIMARY_TBL; +-- +-- Unique keys +-- +CREATE TABLE UNIQUE_TBL (i int UNIQUE, t text); +NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_key" for table "unique_tbl" +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +INSERT INTO UNIQUE_TBL VALUES (2, 'two'); +INSERT INTO UNIQUE_TBL VALUES (1, 'three'); +ERROR: duplicate key value violates unique constraint "unique_tbl_i_key" +DETAIL: Key (i)=(1) already exists. +INSERT INTO UNIQUE_TBL VALUES (4, 'four'); +INSERT INTO UNIQUE_TBL VALUES (5, 'one'); +INSERT INTO UNIQUE_TBL (t) VALUES ('six'); +INSERT INTO UNIQUE_TBL (t) VALUES ('seven'); +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; + five | i | t +------+---+------- + | 1 | one + | 2 | two + | 4 | four + | 5 | one + | | seven + | | six +(6 rows) + +DROP TABLE UNIQUE_TBL; +CREATE TABLE UNIQUE_TBL (i int, t text, + UNIQUE(i,t)); +NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_t_key" for table "unique_tbl" +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +INSERT INTO UNIQUE_TBL VALUES (2, 'two'); +INSERT INTO UNIQUE_TBL VALUES (1, 'three'); +INSERT INTO UNIQUE_TBL VALUES (1, 'one'); +ERROR: duplicate key value violates unique constraint "unique_tbl_i_t_key" +DETAIL: Key (i, t)=(1, one) already exists. +INSERT INTO UNIQUE_TBL VALUES (5, 'one'); +INSERT INTO UNIQUE_TBL (t) VALUES ('six'); +SELECT '' AS five, * FROM UNIQUE_TBL order by i,t; + five | i | t +------+---+------- + | 1 | one + | 1 | three + | 2 | two + | 5 | one + | | six +(5 rows) + +DROP TABLE UNIQUE_TBL; +-- +-- Deferrable unique constraints +-- +CREATE TABLE unique_tbl (i int UNIQUE DEFERRABLE, t text); +NOTICE: CREATE TABLE / UNIQUE will create implicit index "unique_tbl_i_key" for table "unique_tbl" +INSERT INTO unique_tbl VALUES (0, 'one'); +INSERT INTO unique_tbl VALUES (1, 'two'); +INSERT INTO unique_tbl VALUES (2, 'tree'); +INSERT INTO unique_tbl VALUES (3, 'four'); +INSERT INTO unique_tbl VALUES (4, 'five'); +BEGIN; +-- default is immediate so this should fail right away +UPDATE unique_tbl SET i = 1 WHERE i = 0; +ERROR: Partition column can't be updated in current version +ROLLBACK; +-- check is done at end of statement, so this should succeed +UPDATE unique_tbl SET i = i+1; +ERROR: Partition column can't be updated in current version +SELECT * FROM unique_tbl ORDER BY 1,t; + i | t +---+------ + 0 | one + 1 | two + 2 | tree + 3 | four + 4 | five +(5 rows) + +-- explicitly defer the constraint +BEGIN; +SET CONSTRAINTS unique_tbl_i_key DEFERRED; +ERROR: Postgres-XC does not support DEFERRED constraints yet +DETAIL: The feature is not currently supported +INSERT INTO unique_tbl VALUES (3, 'three'); +ERROR: current transaction is aborted, commands ignored until end of transaction block +DELETE FROM unique_tbl WHERE t = 'tree'; -- makes constraint valid again +ERROR: current transaction is aborted, commands ignored until end of transaction block +COMMIT; -- should succeed +SELECT * FROM unique_tbl ORDER BY 1,t; + i | t +---+------ + 0 | one + 1 | two + 2 | tree + 3 | four + 4 | five +(5 rows) + +-- try adding an initially deferred constraint +ALTER TABLE unique_tbl DROP CONSTRAINT unique_tbl_i_key; +ALTER TABLE unique_tbl ADD CONSTRAINT unique_tbl_i_key + UNIQUE (i) DEFERRABLE INITIALLY DEFERRED; +ERROR: Postgres-XC does not support DEFERRED constraints yet +DETAIL: The feature is not currently supported +BEGIN; +INSERT INTO unique_tbl VALUES (1, 'five'); +INSERT INTO unique_tbl VALUES (5, 'one'); +UPDATE unique_tbl SET i = 4 WHERE i = 2; +ERROR: Partition column can't be updated in current version +UPDATE unique_tbl SET i = 2 WHERE i = 4 AND t = 'four'; +ERROR: current transaction is aborted, commands ignored until end of transaction block +DELETE FROM unique_tbl WHERE i = 1 AND t = 'one'; +ERROR: current transaction is aborted, commands ignored until end of transaction block +DELETE FROM unique_tbl WHERE i = 5 AND t = 'five'; +ERROR: current transaction is aborted, commands ignored until end of transaction block +COMMIT; +SELECT * FROM unique_tbl ORDER BY 1,t; + i | t +---+------ + 0 | one + 1 | two + 2 | tree + 3 | four + 4 | five +(5 rows) + +-- should fail at commit-time +BEGIN; +INSERT INTO unique_tbl VALUES (3, 'Three'); -- should succeed for now +COMMIT; -- should fail +-- make constraint check immediate +BEGIN; +SET CONSTRAINTS ALL IMMEDIATE; +INSERT INTO unique_tbl VALUES (3, 'Three'); -- should fail +COMMIT; +-- forced check when SET CONSTRAINTS is called +BEGIN; +SET CONSTRAINTS ALL DEFERRED; +ERROR: Postgres-XC does not support DEFERRED constraints yet +DETAIL: The feature is not currently supported +INSERT INTO unique_tbl VALUES (3, 'Three'); -- should succeed for now +ERROR: current transaction is aborted, commands ignored until end of transaction block +SET CONSTRAINTS ALL IMMEDIATE; -- should fail +ERROR: current transaction is aborted, commands ignored until end of transaction block +COMMIT; +-- test a HOT update that invalidates the conflicting tuple. +-- the trigger should still fire and catch the violation +BEGIN; +INSERT INTO unique_tbl VALUES (3, 'Three'); -- should succeed for now +UPDATE unique_tbl SET t = 'THREE' WHERE i = 3 AND t = 'Three'; +COMMIT; -- should fail +SELECT * FROM unique_tbl ORDER BY 1,t; + i | t +---+------- + 0 | one + 1 | two + 2 | tree + 3 | THREE + 3 | THREE + 3 | THREE + 3 | four + 4 | five +(8 rows) + +-- test a HOT update that modifies the newly inserted tuple, +-- but should succeed because we then remove the other conflicting tuple. +BEGIN; +INSERT INTO unique_tbl VALUES(3, 'tree'); -- should succeed for now +UPDATE unique_tbl SET t = 'threex' WHERE t = 'tree'; +DELETE FROM unique_tbl WHERE t = 'three'; +SELECT * FROM unique_tbl ORDER BY 1,t; + i | t +---+-------- + 0 | one + 1 | two + 2 | threex + 3 | THREE + 3 | THREE + 3 | THREE + 3 | four + 3 | threex + 4 | five +(9 rows) + +COMMIT; +SELECT * FROM unique_tbl ORDER BY 1,t; + i | t +---+-------- + 0 | one + 1 | two + 2 | threex + 3 | THREE + 3 | THREE + 3 | THREE + 3 | four + 3 | threex + 4 | five +(9 rows) + +DROP TABLE unique_tbl; +-- +-- EXCLUDE constraints +-- +CREATE TABLE circles ( + c1 CIRCLE, + c2 TEXT, + EXCLUDE USING gist + (c1 WITH &&, (c2::circle) WITH &&) + WHERE (circle_center(c1) <> '(0,0)') +); +NOTICE: CREATE TABLE / EXCLUDE will create implicit index "circles_c1_c2_excl" for table "circles" +-- these should succeed because they don't match the index predicate +INSERT INTO circles VALUES('<(0,0), 5>', '<(0,0), 5>'); +INSERT INTO circles VALUES('<(0,0), 5>', '<(0,0), 4>'); +-- succeed +INSERT INTO circles VALUES('<(10,10), 10>', '<(0,0), 5>'); +-- fail, overlaps +INSERT INTO circles VALUES('<(20,20), 10>', '<(0,0), 4>'); +-- succeed because c1 doesn't overlap +INSERT INTO circles VALUES('<(20,20), 1>', '<(0,0), 5>'); +-- succeed because c2 doesn't overlap +INSERT INTO circles VALUES('<(20,20), 10>', '<(10,10), 5>'); +-- should fail on existing data without the WHERE clause +ALTER TABLE circles ADD EXCLUDE USING gist + (c1 WITH &&, (c2::circle) WITH &&); +NOTICE: ALTER TABLE / ADD EXCLUDE will create implicit index "circles_c1_c2_excl1" for table "circles" +ERROR: could not create exclusion constraint "circles_c1_c2_excl1" +DETAIL: Key (c1, (c2::circle))=(<(0,0),5>, <(0,0),5>) conflicts with key (c1, (c2::circle))=(<(10,10),10>, <(0,0),5>). +DROP TABLE circles; +-- Check deferred exclusion constraint +CREATE TABLE deferred_excl ( + f1 int, + CONSTRAINT deferred_excl_con EXCLUDE (f1 WITH =) INITIALLY DEFERRED +); +ERROR: Postgres-XC does not support DEFERRED constraints yet +DETAIL: The feature is not currently supported +INSERT INTO deferred_excl VALUES(1); +ERROR: relation "deferred_excl" does not exist +LINE 1: INSERT INTO deferred_excl VALUES(1); + ^ +INSERT INTO deferred_excl VALUES(2); +ERROR: relation "deferred_excl" does not exist +LINE 1: INSERT INTO deferred_excl VALUES(2); + ^ +INSERT INTO deferred_excl VALUES(1); -- fail +ERROR: relation "deferred_excl" does not exist +LINE 1: INSERT INTO deferred_excl VALUES(1); + ^ +BEGIN; +INSERT INTO deferred_excl VALUES(2); -- no fail here +ERROR: relation "deferred_excl" does not exist +LINE 1: INSERT INTO deferred_excl VALUES(2); + ^ +COMMIT; -- should fail here +BEGIN; +INSERT INTO deferred_excl VALUES(3); +ERROR: relation "deferred_excl" does not exist +LINE 1: INSERT INTO deferred_excl VALUES(3); + ^ +INSERT INTO deferred_excl VALUES(3); -- no fail here +ERROR: current transaction is aborted, commands ignored until end of transaction block +COMMIT; -- should fail here +ALTER TABLE deferred_excl DROP CONSTRAINT deferred_excl_con; +ERROR: relation "deferred_excl" does not exist +-- This should fail, but worth testing because of HOT updates +UPDATE deferred_excl SET f1 = 3; +ERROR: relation "deferred_excl" does not exist +LINE 1: UPDATE deferred_excl SET f1 = 3; + ^ +ALTER TABLE deferred_excl ADD EXCLUDE (f1 WITH =); +ERROR: relation "deferred_excl" does not exist +DROP TABLE deferred_excl; +ERROR: table "deferred_excl" does not exist ----------------------------------------------------------------------- Summary of changes: src/test/regress/input/constraints.source | 12 +- .../{constraints.source => constraints_1.source} | 374 ++++++++++++-------- 2 files changed, 228 insertions(+), 158 deletions(-) copy src/test/regress/output/{constraints.source => constraints_1.source} (63%) hooks/post-receive -- Postgres-XC |
From: Koichi S. <koi...@gm...> - 2011-04-08 08:26:45
|
Year. I believe 1st cut is very important to make the solution general. We used to take the second cut first and this influenced the cover range of the statment. (It was very useful to run DBT-1 though). Regards; ---------- Koichi Suzuki 2011/4/8 Ashutosh Bapat <ash...@en...>: > Before I forget, Koichi, your sourceforge address bounced, so my mail only > reached Mason. Thanks Mason for including others in the thread again. > > On Fri, Apr 8, 2011 at 6:04 AM, Koichi Suzuki <koi...@gm...> wrote: >> >> Thank you for valuable advice. We also should think how GROUP BY can >> be pushed down to datanodes so that coordinator can simply merge the >> result. > > If I understand it right, Mason has already given solution to that problem. > We push the groupby down to datanodes with additional order by clause > (ordering based on the group by expressions) on top of them (this looks > tricky if there are already other order by clauses). Thus the data we > collect at coordinator is already grouped per datanode and all coordinator > has to do is to consolidate each row from the data nodes in order like we do > in merge sort. > > I see that we may have to do this in steps. > 1. first cut - implement to apply group by only at coordinator. Not so > efficient, but will make group by work > 2. second cut - implement pushing down group by to the data nodes, better > than one but still the grouping at coordinator is not that efficient > 3. third cut - implement above idea fully > > We might be able to do 1 and 2 in the first cut itself. But this is too > early to say anything. I will get back once, I know things better. > > Mason has also pointed to the possibility of distributing grouping phase at > coordinator across datanodes (in third cut) so that coordinator is not > loaded if there are too many columns in the group by. But that requires the > infrastructure to ship rows from coordinator to datanodes. This > infrastructure is not place, I think. So that is a far possibility for now. > > >> >> ---------- >> Koichi Suzuki >> >> >> >> 2011/4/7 Mason <ma...@us...>: >> > I looked at the schedule. >> > >> > I am not sure about the planned design for GROUP BY, but originally >> > Andrei was planning on making it somewhat similar to ORDER BY, how >> > ORDER BY does a merge sort on the coordinator, based on sorted results >> > from the data nodes. Each data node could do the beginning phase of >> > aggregation in groups and then sort the output in the same manner of >> > the groups. Then, the coordinator could do the last step of >> > aggregation with like groups, which is easy to get them on the fly >> > because of the sorting coming in from the data nodes (and avoiding >> > materialization). >> > >> > This should work pretty well. One drawback is if they chose a GROUP >> > BY clause with many groups (many = thousands+). Then some parallelism >> > is lost because of the final phase being done in only one place, on >> > the Coordinator. GridSQL spreads out the final aggregation phase >> > amongst all the data nodes, moving like groups to the same node to get >> > more parallelism. I think row shipping infrastructure might have to be >> > in place first before implementing that, and there will be a >> > noticeable benefit only once there are many, many groups, so I don't >> > see it being a critical thing at this phase and can be added later. >> > >> > Regards, >> > >> > Mason >> > >> > >> > >> > On Thu, Apr 7, 2011 at 5:27 AM, Koichi Suzuki >> > <koi...@us...> wrote: >> >> Project "Postgres-XC documentation". >> >> >> >> The branch, master has been updated >> >> via 62434399fdd57aff2701e3e5e97fed619f6d6820 (commit) >> >> from 252519c2be5309a3682b0ee895cf040083ae1784 (commit) >> >> >> >> >> >> - Log ----------------------------------------------------------------- >> >> commit 62434399fdd57aff2701e3e5e97fed619f6d6820 >> >> Author: Koichi Suzuki <koi...@gm...> >> >> Date: Thu Apr 7 18:27:26 2011 +0900 >> >> >> >> 1. Added 2011FYQ1 schedule for each member. >> >> 2. Modified my progress sheet of Reference Manual. >> >> >> >> -- Koichi Suzuki >> >> >> >> diff --git a/progress/2011FYQ1_Schedule.ods >> >> b/progress/2011FYQ1_Schedule.ods >> >> new file mode 100755 >> >> index 0000000..5e24d37 >> >> Binary files /dev/null and b/progress/2011FYQ1_Schedule.ods differ >> >> diff --git a/progress/documentation-progress.ods >> >> b/progress/documentation-progress.ods >> >> index 277aade..2c8577e 100644 >> >> Binary files a/progress/documentation-progress.ods and >> >> b/progress/documentation-progress.ods differ >> >> >> >> ----------------------------------------------------------------------- >> >> >> >> Summary of changes: >> >> progress/2011FYQ1_Schedule.ods | Bin 0 -> 22147 bytes >> >> progress/documentation-progress.ods | Bin 16883 -> 19519 bytes >> >> 2 files changed, 0 insertions(+), 0 deletions(-) >> >> create mode 100755 progress/2011FYQ1_Schedule.ods >> >> >> >> >> >> hooks/post-receive >> >> -- >> >> Postgres-XC documentation >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Xperia(TM) PLAY >> >> It's a major breakthrough. An authentic gaming >> >> smartphone on the nation's most reliable network. >> >> And it wants your games. >> >> http://p.sf.net/sfu/verizon-sfdev >> >> _______________________________________________ >> >> Postgres-xc-committers mailing list >> >> Pos...@li... >> >> https://lists.sourceforge.net/lists/listinfo/postgres-xc-committers >> >> >> > >> > >> > ------------------------------------------------------------------------------ >> > Xperia(TM) PLAY >> > It's a major breakthrough. An authentic gaming >> > smartphone on the nation's most reliable network. >> > And it wants your games. >> > http://p.sf.net/sfu/verizon-sfdev >> > _______________________________________________ >> > Postgres-xc-committers mailing list >> > Pos...@li... >> > https://lists.sourceforge.net/lists/listinfo/postgres-xc-committers >> > > > > > -- > Best Wishes, > Ashutosh Bapat > EntepriseDB Corporation > The Enterprise Postgres Company > > |
From: Michael P. <mic...@us...> - 2011-04-08 08:05:42
|
Project "Postgres-XC". The branch, master has been updated via 0fd3d4109912f1685bbd8ee657df2e92a4ec69f7 (commit) from 219e41d7324c86ceb537df13214774b70051a833 (commit) - Log ----------------------------------------------------------------- commit 0fd3d4109912f1685bbd8ee657df2e92a4ec69f7 Author: Michael P <mic...@us...> Date: Fri Apr 8 16:53:19 2011 +0900 Block use of non-immutable functions as DEFAULT values DEFAULT is used by CREATE/ALTER TABLE/DOMAIN. A DML query using a default with non-immutable function needs to be fed by Coordinator. This is particularly necessary in the case of replicated tables. But even in the case of distributed tables timestamp values have to be taken from GTM to avoid data inconsistencies through the cluster. As a possible implementation, a constraint with non-immutable functions is just created on Coordinator and not on Datanodes. When a DML query needs a default value Coordinator feeds it, rewrites the query, and distributes it to Datanodes so as the uniqueness of the value is insured. Sequence (currval, nextval) and timestamp values (now()...) have to be taken from GTM. diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index 64eab92..8b25ace 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -2399,6 +2399,28 @@ cookDefault(ParseState *pstate, Assert(raw_default != NULL); +#ifdef PGXC + /* + * Block use of non-immutable functions as DEFAULT. + * + * Support of nextval(), currval(), now() as DEFAULT value in XC needs a special support + * like SERIAL, so block it for the time being + * + * PGXCTODO: As possible implementation, a constraint with non-immutable functions + * is just created on Coordinator and when an INSERT query needs a default value + * Coordinator feeds it, rewrite the query, and distributes it to Datanodes + * + * Sequence (currval, nextval) and timestamp values (now()...) have + * to be taken from GTM. + */ + if (IsA(raw_default,FuncCall)) + if (!IsFuncImmutable(pstate, (FuncCall *) raw_default)) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("Postgres-XC does not support DEFAULT with non-immutable functions yet"), + errdetail("The feature is not currently supported"))); +#endif + /* * Transform raw parsetree to executable expression. */ diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index addd0d4..2159a68 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -1232,6 +1232,30 @@ transformFuncCall(ParseState *pstate, FuncCall *fn) fn->location); } +#ifdef PGXC +/* + * IsFuncImmutable + * + * Check if given function is immutable or not + * based on the function name and on its arguments + */ +bool +IsFuncImmutable(ParseState *pstate, FuncCall *fn) +{ + ListCell *args; + List *targs = NIL; + + /* Transform list of arguments */ + foreach(args, fn->args) + { + targs = lappend(targs, transformExpr(pstate, + (Node *) lfirst(args))); + } + + return IsParseFuncImmutable(pstate, targs, fn->funcname, fn->func_variadic); +} +#endif + static Node * transformCaseExpr(ParseState *pstate, CaseExpr *c) { diff --git a/src/backend/parser/parse_func.c b/src/backend/parser/parse_func.c index 2cbc9f5..da8abee 100644 --- a/src/backend/parser/parse_func.c +++ b/src/backend/parser/parse_func.c @@ -1654,6 +1654,101 @@ check_pg_get_expr_args(ParseState *pstate, Oid fnoid, List *args) errmsg("argument to pg_get_expr() must come from system catalogs"))); } +#ifdef PGXC +/* + * IsParseFuncImmutable + * + * Check if given function is immutable or not + * based on the function name and on its arguments + * This functionnality will be extended to support functions in constraints + */ +bool +IsParseFuncImmutable(ParseState *pstate, List *targs, List *funcname, bool func_variadic) +{ + ListCell *l; + ListCell *nextl; + FuncDetailCode fdresult; + Oid actual_arg_types[FUNC_MAX_ARGS]; + List *argnames; + int nargs; + /* Return results */ + Oid funcid, rettype; + Oid *declared_arg_types; + bool retset; + int nvargs; + List *argdefaults; + + /* Get detailed argument information */ + nargs = 0; + for (l = list_head(targs); l != NULL; l = nextl) + { + Node *arg = lfirst(l); + Oid argtype = exprType(arg); + + nextl = lnext(l); + + if (argtype == VOIDOID && IsA(arg, Param)) + { + targs = list_delete_ptr(targs, arg); + continue; + } + actual_arg_types[nargs++] = argtype; + } + argnames = NIL; + + foreach(l, targs) + { + Node *arg = lfirst(l); + + if (IsA(arg, NamedArgExpr)) + { + NamedArgExpr *na = (NamedArgExpr *) arg; + ListCell *lc; + + /* Reject duplicate arg names */ + foreach(lc, argnames) + { + if (strcmp(na->name, (char *) lfirst(lc)) == 0) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("argument name \"%s\" used more than once", + na->name), + parser_errposition(pstate, na->location))); + } + argnames = lappend(argnames, na->name); + } + else + { + if (argnames != NIL) + ereport(ERROR, + (errcode(ERRCODE_SYNTAX_ERROR), + errmsg("positional argument cannot follow named argument"), + parser_errposition(pstate, exprLocation(arg)))); + } + } + + fdresult = func_get_detail(funcname, + targs, + argnames, + nargs, + actual_arg_types, + !func_variadic, + true, + &funcid, &rettype, &retset, &nvargs, + &declared_arg_types, &argdefaults); + + /* + * Now only the function ID is used to check if function is immutable or not, + * but for function support in DEFAULT values, this function can be easily extended + * for other analysis purposes. + */ + if (func_volatile(funcid) == PROVOLATILE_IMMUTABLE) + return true; + else + return false; +} +#endif + static bool check_pg_get_expr_arg(ParseState *pstate, Node *arg, int netlevelsup) { diff --git a/src/include/parser/parse_expr.h b/src/include/parser/parse_expr.h index 654bf34..dce33db 100644 --- a/src/include/parser/parse_expr.h +++ b/src/include/parser/parse_expr.h @@ -19,5 +19,8 @@ extern bool Transform_null_equals; extern Node *transformExpr(ParseState *pstate, Node *expr); +#ifdef PGXC +extern bool IsFuncImmutable(ParseState *pstate, FuncCall *fn); +#endif #endif /* PARSE_EXPR_H */ diff --git a/src/include/parser/parse_func.h b/src/include/parser/parse_func.h index 05f07c7..544179a 100644 --- a/src/include/parser/parse_func.h +++ b/src/include/parser/parse_func.h @@ -83,5 +83,8 @@ extern Oid LookupAggNameTypeNames(List *aggname, List *argtypes, bool noError); extern void check_pg_get_expr_args(ParseState *pstate, Oid fnoid, List *args); +#ifdef PGXC +extern bool IsParseFuncImmutable(ParseState *pstate, List *fn_args, List *funcname, bool func_variadic); +#endif #endif /* PARSE_FUNC_H */ diff --git a/src/test/regress/expected/dependency_1.out b/src/test/regress/expected/dependency_1.out index ecf687d..827f442 100644 --- a/src/test/regress/expected/dependency_1.out +++ b/src/test/regress/expected/dependency_1.out @@ -102,7 +102,8 @@ CREATE TABLE deptest2 (f1 int); -- make a serial column the hard way CREATE SEQUENCE ss1; ALTER TABLE deptest2 ALTER f1 SET DEFAULT nextval('ss1'); -ERROR: relation "ss1" does not exist +ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet +DETAIL: The feature is not currently supported ALTER SEQUENCE ss1 OWNED BY deptest2.f1; RESET SESSION AUTHORIZATION; REASSIGN OWNED BY regression_user1 TO regression_user2; diff --git a/src/test/regress/expected/uuid_1.out b/src/test/regress/expected/uuid_1.out index 6a593be..39ea1e9 100644 --- a/src/test/regress/expected/uuid_1.out +++ b/src/test/regress/expected/uuid_1.out @@ -5,144 +5,147 @@ CREATE TABLE guid1 guid_field UUID, text_field TEXT DEFAULT(now()) ); +ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet +DETAIL: The feature is not currently supported CREATE TABLE guid2 ( guid_field UUID, text_field TEXT DEFAULT(now()) ); +ERROR: Postgres-XC does not support DEFAULT with non-immutable functions yet +DETAIL: The feature is not currently supported -- inserting invalid data tests -- too long INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111F'); -ERROR: invalid input syntax for uuid: "11111111-1111-1111-1111-111111111111F" +ERROR: relation "guid1" does not exist LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-111... - ^ + ^ -- too short INSERT INTO guid1(guid_field) VALUES('{11111111-1111-1111-1111-11111111111}'); -ERROR: invalid input syntax for uuid: "{11111111-1111-1111-1111-11111111111}" +ERROR: relation "guid1" does not exist LINE 1: INSERT INTO guid1(guid_field) VALUES('{11111111-1111-1111-11... - ^ + ^ -- valid data but invalid format INSERT INTO guid1(guid_field) VALUES('111-11111-1111-1111-1111-111111111111'); -ERROR: invalid input syntax for uuid: "111-11111-1111-1111-1111-111111111111" +ERROR: relation "guid1" does not exist LINE 1: INSERT INTO guid1(guid_field) VALUES('111-11111-1111-1111-11... - ^ + ^ INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222 '); -ERROR: invalid input syntax for uuid: "{22222222-2222-2222-2222-222222222222 " +ERROR: relation "guid1" does not exist LINE 1: INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-22... - ^ + ^ -- invalid data INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-G111-111111111111'); -ERROR: invalid input syntax for uuid: "11111111-1111-1111-G111-111111111111" +ERROR: relation "guid1" does not exist LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-G11... - ^ + ^ INSERT INTO guid1(guid_field) VALUES('11+11111-1111-1111-1111-111111111111'); -ERROR: invalid input syntax for uuid: "11+11111-1111-1111-1111-111111111111" +ERROR: relation "guid1" does not exist LINE 1: INSERT INTO guid1(guid_field) VALUES('11+11111-1111-1111-111... - ^ + ^ --inserting three input formats INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111'); +ERROR: relation "guid1" does not exist +LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-111... + ^ INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-2222-222222222222}'); +ERROR: relation "guid1" does not exist +LINE 1: INSERT INTO guid1(guid_field) VALUES('{22222222-2222-2222-22... + ^ INSERT INTO guid1(guid_field) VALUES('3f3e3c3b3a3039383736353433a2313e'); +ERROR: relation "guid1" does not exist +LINE 1: INSERT INTO guid1(guid_field) VALUES('3f3e3c3b3a303938373635... + ^ -- retrieving the inserted data SELECT guid_field FROM guid1 ORDER BY guid_field; - guid_field --------------------------------------- - 11111111-1111-1111-1111-111111111111 - 22222222-2222-2222-2222-222222222222 - 3f3e3c3b-3a30-3938-3736-353433a2313e -(3 rows) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT guid_field FROM guid1 ORDER BY guid_field; + ^ -- ordering test SELECT guid_field FROM guid1 ORDER BY guid_field ASC; - guid_field --------------------------------------- - 11111111-1111-1111-1111-111111111111 - 22222222-2222-2222-2222-222222222222 - 3f3e3c3b-3a30-3938-3736-353433a2313e -(3 rows) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT guid_field FROM guid1 ORDER BY guid_field ASC; + ^ SELECT guid_field FROM guid1 ORDER BY guid_field DESC; - guid_field --------------------------------------- - 3f3e3c3b-3a30-3938-3736-353433a2313e - 22222222-2222-2222-2222-222222222222 - 11111111-1111-1111-1111-111111111111 -(3 rows) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT guid_field FROM guid1 ORDER BY guid_field DESC; + ^ -- = operator test SELECT COUNT(*) FROM guid1 WHERE guid_field = '3f3e3c3b-3a30-3938-3736-353433a2313e'; - count -------- - 1 -(1 row) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field = '3f3e3c3b-3a30... + ^ -- <> operator test SELECT COUNT(*) FROM guid1 WHERE guid_field <> '11111111111111111111111111111111'; - count -------- - 2 -(1 row) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field <> '111111111111... + ^ -- < operator test SELECT COUNT(*) FROM guid1 WHERE guid_field < '22222222-2222-2222-2222-222222222222'; - count -------- - 1 -(1 row) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field < '22222222-2222... + ^ -- <= operator test SELECT COUNT(*) FROM guid1 WHERE guid_field <= '22222222-2222-2222-2222-222222222222'; - count -------- - 2 -(1 row) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field <= '22222222-222... + ^ -- > operator test SELECT COUNT(*) FROM guid1 WHERE guid_field > '22222222-2222-2222-2222-222222222222'; - count -------- - 1 -(1 row) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field > '22222222-2222... + ^ -- >= operator test SELECT COUNT(*) FROM guid1 WHERE guid_field >= '22222222-2222-2222-2222-222222222222'; - count -------- - 2 -(1 row) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT COUNT(*) FROM guid1 WHERE guid_field >= '22222222-222... + ^ -- btree and hash index creation test CREATE INDEX guid1_btree ON guid1 USING BTREE (guid_field); +ERROR: relation "guid1" does not exist CREATE INDEX guid1_hash ON guid1 USING HASH (guid_field); +ERROR: relation "guid1" does not exist -- unique index test CREATE UNIQUE INDEX guid1_unique_BTREE ON guid1 USING BTREE (guid_field); -ERROR: Cannot locally enforce a unique index on round robin distributed table. +ERROR: relation "guid1" does not exist -- should fail INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-1111-111111111111'); +ERROR: relation "guid1" does not exist +LINE 1: INSERT INTO guid1(guid_field) VALUES('11111111-1111-1111-111... + ^ -- check to see whether the new indexes are actually there SELECT count(*) FROM pg_class WHERE relkind='i' AND relname LIKE 'guid%'; count ------- - 2 + 0 (1 row) -- populating the test tables with additional records INSERT INTO guid1(guid_field) VALUES('44444444-4444-4444-4444-444444444444'); +ERROR: relation "guid1" does not exist +LINE 1: INSERT INTO guid1(guid_field) VALUES('44444444-4444-4444-444... + ^ INSERT INTO guid2(guid_field) VALUES('11111111-1111-1111-1111-111111111111'); +ERROR: relation "guid2" does not exist +LINE 1: INSERT INTO guid2(guid_field) VALUES('11111111-1111-1111-111... + ^ INSERT INTO guid2(guid_field) VALUES('{22222222-2222-2222-2222-222222222222}'); +ERROR: relation "guid2" does not exist +LINE 1: INSERT INTO guid2(guid_field) VALUES('{22222222-2222-2222-22... + ^ INSERT INTO guid2(guid_field) VALUES('3f3e3c3b3a3039383736353433a2313e'); +ERROR: relation "guid2" does not exist +LINE 1: INSERT INTO guid2(guid_field) VALUES('3f3e3c3b3a303938373635... + ^ -- join test SELECT COUNT(*) FROM guid1 g1 INNER JOIN guid2 g2 ON g1.guid_field = g2.guid_field; - count -------- - 4 -(1 row) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT COUNT(*) FROM guid1 g1 INNER JOIN guid2 g2 ON g1.guid... + ^ SELECT COUNT(*) FROM guid1 g1 LEFT JOIN guid2 g2 ON g1.guid_field = g2.guid_field WHERE g2.guid_field IS NULL; - count -------- - 1 -(1 row) - +ERROR: relation "guid1" does not exist +LINE 1: SELECT COUNT(*) FROM guid1 g1 LEFT JOIN guid2 g2 ON g1.guid_... + ^ -- clean up DROP TABLE guid1, guid2 CASCADE; +ERROR: table "guid1" does not exist ----------------------------------------------------------------------- Summary of changes: src/backend/catalog/heap.c | 22 ++++ src/backend/parser/parse_expr.c | 24 +++++ src/backend/parser/parse_func.c | 95 +++++++++++++++++ src/include/parser/parse_expr.h | 3 + src/include/parser/parse_func.h | 3 + src/test/regress/expected/dependency_1.out | 3 +- src/test/regress/expected/uuid_1.out | 153 ++++++++++++++-------------- 7 files changed, 227 insertions(+), 76 deletions(-) hooks/post-receive -- Postgres-XC |
From: Koichi S. <koi...@us...> - 2011-04-08 07:28:40
|
Project "Postgres-XC". The branch, ha_support has been updated via 2974169569091d02a67feaf2b5dcc93b575965e5 (commit) from 5dddee958a4b124741d1e76c4187a04f73852f94 (commit) - Log ----------------------------------------------------------------- commit 2974169569091d02a67feaf2b5dcc93b575965e5 Author: Koichi Suzuki <koi...@gm...> Date: Fri Apr 8 16:28:31 2011 +0900 gtm_ctl.c is modified so that it can accept reconnect command only for gtm_proxy. diff --git a/src/gtm/gtm_ctl/gtm_ctl.c b/src/gtm/gtm_ctl/gtm_ctl.c index 1fdce3b..5092a47 100644 --- a/src/gtm/gtm_ctl/gtm_ctl.c +++ b/src/gtm/gtm_ctl/gtm_ctl.c @@ -593,6 +593,14 @@ do_reconnect(void) char *reconnect_point_file_nam; FILE *reconnect_point_file; + /* + * Target must beo "gtm_proxy" + */ + if (strcmp(gtm_app, "gtm_proxy") != 0) + { + write_stderr(_("%s: only gtm_proxy can accept reconnect command\n"), progname); + exit(1); + } pid = get_pgpid(); if (pid == 0) /* no pid file */ ----------------------------------------------------------------------- Summary of changes: src/gtm/gtm_ctl/gtm_ctl.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) hooks/post-receive -- Postgres-XC |
From: Andrei M. <and...@gm...> - 2011-04-08 07:28:21
|
Hi, Actually the ORDER BY is not always has to be pushed down to data nodes. Postgres may decide to group by hash. In this case sorting is unnecessary operation. However it may be a problem to determine on coordinator, if data node is going to use sort or hash grouping. Aggregate functions are already changed so values are pre-aggregated on datanodes, and coordinator completes aggregation. This should not be a problem. 2011/4/8 Ashutosh Bapat <ash...@en...> > Before I forget, Koichi, your sourceforge address bounced, so my mail only > reached Mason. Thanks Mason for including others in the thread again. > > On Fri, Apr 8, 2011 at 6:04 AM, Koichi Suzuki <koi...@gm...>wrote: > >> Thank you for valuable advice. We also should think how GROUP BY can >> be pushed down to datanodes so that coordinator can simply merge the >> result. >> > > If I understand it right, Mason has already given solution to that problem. > We push the groupby down to datanodes with additional order by clause > (ordering based on the group by expressions) on top of them (this looks > tricky if there are already other order by clauses). Thus the data we > collect at coordinator is already grouped per datanode and all coordinator > has to do is to consolidate each row from the data nodes in order like we do > in merge sort. > > I see that we may have to do this in steps. > 1. first cut - implement to apply group by only at coordinator. Not so > efficient, but will make group by work > 2. second cut - implement pushing down group by to the data nodes, better > than one but still the grouping at coordinator is not that efficient > 3. third cut - implement above idea fully > > We might be able to do 1 and 2 in the first cut itself. But this is too > early to say anything. I will get back once, I know things better. > > Mason has also pointed to the possibility of distributing grouping phase at > coordinator across datanodes (in third cut) so that coordinator is not > loaded if there are too many columns in the group by. But that requires the > infrastructure to ship rows from coordinator to datanodes. This > infrastructure is not place, I think. So that is a far possibility for now. > > > >> >> ---------- >> Koichi Suzuki >> >> >> >> 2011/4/7 Mason <ma...@us...>: >> > I looked at the schedule. >> > >> > I am not sure about the planned design for GROUP BY, but originally >> > Andrei was planning on making it somewhat similar to ORDER BY, how >> > ORDER BY does a merge sort on the coordinator, based on sorted results >> > from the data nodes. Each data node could do the beginning phase of >> > aggregation in groups and then sort the output in the same manner of >> > the groups. Then, the coordinator could do the last step of >> > aggregation with like groups, which is easy to get them on the fly >> > because of the sorting coming in from the data nodes (and avoiding >> > materialization). >> > >> > This should work pretty well. One drawback is if they chose a GROUP >> > BY clause with many groups (many = thousands+). Then some parallelism >> > is lost because of the final phase being done in only one place, on >> > the Coordinator. GridSQL spreads out the final aggregation phase >> > amongst all the data nodes, moving like groups to the same node to get >> > more parallelism. I think row shipping infrastructure might have to be >> > in place first before implementing that, and there will be a >> > noticeable benefit only once there are many, many groups, so I don't >> > see it being a critical thing at this phase and can be added later. >> > >> > Regards, >> > >> > Mason >> > >> > >> > >> > On Thu, Apr 7, 2011 at 5:27 AM, Koichi Suzuki >> > <koi...@us...> wrote: >> >> Project "Postgres-XC documentation". >> >> >> >> The branch, master has been updated >> >> via 62434399fdd57aff2701e3e5e97fed619f6d6820 (commit) >> >> from 252519c2be5309a3682b0ee895cf040083ae1784 (commit) >> >> >> >> >> >> - Log ----------------------------------------------------------------- >> >> commit 62434399fdd57aff2701e3e5e97fed619f6d6820 >> >> Author: Koichi Suzuki <koi...@gm...> >> >> Date: Thu Apr 7 18:27:26 2011 +0900 >> >> >> >> 1. Added 2011FYQ1 schedule for each member. >> >> 2. Modified my progress sheet of Reference Manual. >> >> >> >> -- Koichi Suzuki >> >> >> >> diff --git a/progress/2011FYQ1_Schedule.ods >> b/progress/2011FYQ1_Schedule.ods >> >> new file mode 100755 >> >> index 0000000..5e24d37 >> >> Binary files /dev/null and b/progress/2011FYQ1_Schedule.ods differ >> >> diff --git a/progress/documentation-progress.ods >> b/progress/documentation-progress.ods >> >> index 277aade..2c8577e 100644 >> >> Binary files a/progress/documentation-progress.ods and >> b/progress/documentation-progress.ods differ >> >> >> >> ----------------------------------------------------------------------- >> >> >> >> Summary of changes: >> >> progress/2011FYQ1_Schedule.ods | Bin 0 -> 22147 bytes >> >> progress/documentation-progress.ods | Bin 16883 -> 19519 bytes >> >> 2 files changed, 0 insertions(+), 0 deletions(-) >> >> create mode 100755 progress/2011FYQ1_Schedule.ods >> >> >> >> >> >> hooks/post-receive >> >> -- >> >> Postgres-XC documentation >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Xperia(TM) PLAY >> >> It's a major breakthrough. An authentic gaming >> >> smartphone on the nation's most reliable network. >> >> And it wants your games. >> >> http://p.sf.net/sfu/verizon-sfdev >> >> _______________________________________________ >> >> Postgres-xc-committers mailing list >> >> Pos...@li... >> >> https://lists.sourceforge.net/lists/listinfo/postgres-xc-committers >> >> >> > >> > >> ------------------------------------------------------------------------------ >> > Xperia(TM) PLAY >> > It's a major breakthrough. An authentic gaming >> > smartphone on the nation's most reliable network. >> > And it wants your games. >> > http://p.sf.net/sfu/verizon-sfdev >> > _______________________________________________ >> > Postgres-xc-committers mailing list >> > Pos...@li... >> > https://lists.sourceforge.net/lists/listinfo/postgres-xc-committers >> > >> > > > > -- > Best Wishes, > Ashutosh Bapat > EntepriseDB Corporation > The Enterprise Postgres Company > > > > ------------------------------------------------------------------------------ > Xperia(TM) PLAY > It's a major breakthrough. An authentic gaming > smartphone on the nation's most reliable network. > And it wants your games. > http://p.sf.net/sfu/verizon-sfdev > _______________________________________________ > Postgres-xc-developers mailing list > Pos...@li... > https://lists.sourceforge.net/lists/listinfo/postgres-xc-developers > > -- Best regards, Andrei Martsinchyk mailto:and...@gm... |
From: Koichi S. <koi...@us...> - 2011-04-08 07:15:38
|
Project "Postgres-XC". The branch, ha_support has been updated via 5dddee958a4b124741d1e76c4187a04f73852f94 (commit) from 0794d85a15b5124f666190926ae036dec9f39855 (commit) - Log ----------------------------------------------------------------- commit 5dddee958a4b124741d1e76c4187a04f73852f94 Author: Koichi Suzuki <koi...@gm...> Date: Fri Apr 8 16:11:14 2011 +0900 This is the first commit ot GTM reconnect to new promoted GTM. Reconnect can be done by gtm_ctl as follows: gtm_ctl -D dir -S gtm_proxy reconnect -o "-s newhost -t newport" Reconnect is notified to gtm_proxy using SIGUSR2 signal. Option parameter will be passed through the file "newgtm" placed at the directory specified by -D option. After this, we should write gtm_proxy handler. diff --git a/src/gtm/gtm_ctl/gtm_ctl.c b/src/gtm/gtm_ctl/gtm_ctl.c index 91690c9..1fdce3b 100644 --- a/src/gtm/gtm_ctl/gtm_ctl.c +++ b/src/gtm/gtm_ctl/gtm_ctl.c @@ -45,6 +45,7 @@ typedef enum PROMOTE_COMMAND, RESTART_COMMAND, STATUS_COMMAND, + RECONNECT_COMMAND, /* gtm_ctl -S gtm_proxy reconnect */ } CtlCommand; #define DEFAULT_WAIT 60 @@ -64,6 +65,8 @@ static char *log_file = NULL; static char *gtm_path = NULL; static char *gtm_app = NULL; static char *argv0 = NULL; +static char *reconnect_host = NULL; +static char *reconnect_port = NULL; static void write_stderr(const char *fmt,...) @@ -78,6 +81,7 @@ static void set_mode(char *modeopt); static void do_start(void); static void do_stop(void); static void do_restart(void); +static void do_reconnect(void); static void print_msg(const char *msg); static pgpid_t get_pgpid(void); @@ -567,6 +571,77 @@ do_promote(void) } } +/* + * At least we expect the following argument + * + * 1) -D datadir + * 2) -o options: we expect that -t and -s options are specified here. + * Check will be done in GTM-Proxy. If there's an error, it will be + * logged. In this case, GTM-Proxy won't terminate. It will continue + * to read/write with old GTM. + * + * Because they are not passed to gtm directly, they should appear in + * gtm_ctl argument, not in -o options. They're specific to gtm_ctl + * reconnect. + * + * + */ +static void +do_reconnect(void) +{ + pgpid_t pid; + char *reconnect_point_file_nam; + FILE *reconnect_point_file; + + pid = get_pgpid(); + + if (pid == 0) /* no pid file */ + { + write_stderr(_("%s: PID file \"%s\" does not exist\n"), progname, pid_file); + write_stderr(_("Is server running?\n")); + exit(1); + } + else if (pid < 0) /* standalone backend, not gtm */ + { + pid = -pid; + write_stderr(_("%s: cannot promote server; " + "single-user server is running (PID: %ld)\n"), + progname, pid); + exit(1); + } + read_gtm_opts(); + reconnect_point_file_nam = malloc(strlen(gtm_data) + 8); + if (reconnect_point_file_nam == NULL) + { + write_stderr(_("%s: No memory available.\n"), progname); + exit(1); + } + snprintf(reconnect_point_file_nam, strlen(gtm_data) + 7, "%s/newgtm", gtm_data); + reconnect_point_file = fopen(reconnect_point_file_nam, "w"); + if (reconnect_point_file == NULL) + { + write_stderr(_("%s: Cannot open reconnect point file %s\n"), progname, reconnect_point_file_nam); + exit(1); + } + fprintf(reconnect_point_file, "%s", gtm_opts); + fclose(reconnect_point_file); + free(reconnect_point_file_nam); + /* + * Beofore signaling, we need to set the host and port of the new target GTM. + * + * They should be written to "newgtm" file under -D directory. + * First line is the host name and the second line is port (all in + * text representation). + */ + /* === WIP 20110408 === */ + if (kill((pid_t) pid, SIGUSR2) != 0) + { + write_stderr(_("%s: could not send promote signal (PID: %ld): %s\n"), progname, pid, + strerror(errno)); + exit(1); + } +} + /* * restart/reload routines @@ -969,9 +1044,12 @@ main(int argc, char **argv) ctl_command = RESTART_COMMAND; else if (strcmp(argv[optind], "status") == 0) ctl_command = STATUS_COMMAND; + else if (strcmp(argv[optind], "reconnect") == 0) + ctl_command = RECONNECT_COMMAND; else { - write_stderr(_("%s: unrecognized operation mode \"%s\"\n"), progname, argv[optind]); + write_stderr(_("%s: unrecognized operation mode \"%s\"\n"), + progname, argv[optind]); do_advice(); exit(1); } @@ -1072,6 +1150,9 @@ main(int argc, char **argv) case STATUS_COMMAND: do_status(); break; + case RECONNECT_COMMAND: + do_reconnect(); + break; default: break; } ----------------------------------------------------------------------- Summary of changes: src/gtm/gtm_ctl/gtm_ctl.c | 83 ++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 82 insertions(+), 1 deletions(-) hooks/post-receive -- Postgres-XC |
From: Ashutosh B. <ash...@en...> - 2011-04-08 07:04:28
|
Before I forget, Koichi, your sourceforge address bounced, so my mail only reached Mason. Thanks Mason for including others in the thread again. On Fri, Apr 8, 2011 at 6:04 AM, Koichi Suzuki <koi...@gm...> wrote: > Thank you for valuable advice. We also should think how GROUP BY can > be pushed down to datanodes so that coordinator can simply merge the > result. > If I understand it right, Mason has already given solution to that problem. We push the groupby down to datanodes with additional order by clause (ordering based on the group by expressions) on top of them (this looks tricky if there are already other order by clauses). Thus the data we collect at coordinator is already grouped per datanode and all coordinator has to do is to consolidate each row from the data nodes in order like we do in merge sort. I see that we may have to do this in steps. 1. first cut - implement to apply group by only at coordinator. Not so efficient, but will make group by work 2. second cut - implement pushing down group by to the data nodes, better than one but still the grouping at coordinator is not that efficient 3. third cut - implement above idea fully We might be able to do 1 and 2 in the first cut itself. But this is too early to say anything. I will get back once, I know things better. Mason has also pointed to the possibility of distributing grouping phase at coordinator across datanodes (in third cut) so that coordinator is not loaded if there are too many columns in the group by. But that requires the infrastructure to ship rows from coordinator to datanodes. This infrastructure is not place, I think. So that is a far possibility for now. > > ---------- > Koichi Suzuki > > > > 2011/4/7 Mason <ma...@us...>: > > I looked at the schedule. > > > > I am not sure about the planned design for GROUP BY, but originally > > Andrei was planning on making it somewhat similar to ORDER BY, how > > ORDER BY does a merge sort on the coordinator, based on sorted results > > from the data nodes. Each data node could do the beginning phase of > > aggregation in groups and then sort the output in the same manner of > > the groups. Then, the coordinator could do the last step of > > aggregation with like groups, which is easy to get them on the fly > > because of the sorting coming in from the data nodes (and avoiding > > materialization). > > > > This should work pretty well. One drawback is if they chose a GROUP > > BY clause with many groups (many = thousands+). Then some parallelism > > is lost because of the final phase being done in only one place, on > > the Coordinator. GridSQL spreads out the final aggregation phase > > amongst all the data nodes, moving like groups to the same node to get > > more parallelism. I think row shipping infrastructure might have to be > > in place first before implementing that, and there will be a > > noticeable benefit only once there are many, many groups, so I don't > > see it being a critical thing at this phase and can be added later. > > > > Regards, > > > > Mason > > > > > > > > On Thu, Apr 7, 2011 at 5:27 AM, Koichi Suzuki > > <koi...@us...> wrote: > >> Project "Postgres-XC documentation". > >> > >> The branch, master has been updated > >> via 62434399fdd57aff2701e3e5e97fed619f6d6820 (commit) > >> from 252519c2be5309a3682b0ee895cf040083ae1784 (commit) > >> > >> > >> - Log ----------------------------------------------------------------- > >> commit 62434399fdd57aff2701e3e5e97fed619f6d6820 > >> Author: Koichi Suzuki <koi...@gm...> > >> Date: Thu Apr 7 18:27:26 2011 +0900 > >> > >> 1. Added 2011FYQ1 schedule for each member. > >> 2. Modified my progress sheet of Reference Manual. > >> > >> -- Koichi Suzuki > >> > >> diff --git a/progress/2011FYQ1_Schedule.ods > b/progress/2011FYQ1_Schedule.ods > >> new file mode 100755 > >> index 0000000..5e24d37 > >> Binary files /dev/null and b/progress/2011FYQ1_Schedule.ods differ > >> diff --git a/progress/documentation-progress.ods > b/progress/documentation-progress.ods > >> index 277aade..2c8577e 100644 > >> Binary files a/progress/documentation-progress.ods and > b/progress/documentation-progress.ods differ > >> > >> ----------------------------------------------------------------------- > >> > >> Summary of changes: > >> progress/2011FYQ1_Schedule.ods | Bin 0 -> 22147 bytes > >> progress/documentation-progress.ods | Bin 16883 -> 19519 bytes > >> 2 files changed, 0 insertions(+), 0 deletions(-) > >> create mode 100755 progress/2011FYQ1_Schedule.ods > >> > >> > >> hooks/post-receive > >> -- > >> Postgres-XC documentation > >> > >> > ------------------------------------------------------------------------------ > >> Xperia(TM) PLAY > >> It's a major breakthrough. An authentic gaming > >> smartphone on the nation's most reliable network. > >> And it wants your games. > >> http://p.sf.net/sfu/verizon-sfdev > >> _______________________________________________ > >> Postgres-xc-committers mailing list > >> Pos...@li... > >> https://lists.sourceforge.net/lists/listinfo/postgres-xc-committers > >> > > > > > ------------------------------------------------------------------------------ > > Xperia(TM) PLAY > > It's a major breakthrough. An authentic gaming > > smartphone on the nation's most reliable network. > > And it wants your games. > > http://p.sf.net/sfu/verizon-sfdev > > _______________________________________________ > > Postgres-xc-committers mailing list > > Pos...@li... > > https://lists.sourceforge.net/lists/listinfo/postgres-xc-committers > > > -- Best Wishes, Ashutosh Bapat EntepriseDB Corporation The Enterprise Postgres Company |
From: Koichi S. <koi...@us...> - 2011-04-08 05:41:29
|
Project "Postgres-XC documentation". The branch, master has been updated via 4c8c9a83834b9513848c2040596a5d310d432e57 (commit) from 62434399fdd57aff2701e3e5e97fed619f6d6820 (commit) - Log ----------------------------------------------------------------- commit 4c8c9a83834b9513848c2040596a5d310d432e57 Author: Koichi Suzuki <koi...@gm...> Date: Fri Apr 8 14:39:52 2011 +0900 Changed Koichi's schedule for May and June. Now preparation of Reference Manual will be done in the following order: 1) Vol.3: Server Administration Guide 2) Vol.1B: SQL Command Reference 3) Vol.1A: SQL Language 4) Vol.2: Programming Guide diff --git a/progress/2011FYQ1_Schedule.ods b/progress/2011FYQ1_Schedule.ods index 5e24d37..d97af84 100755 Binary files a/progress/2011FYQ1_Schedule.ods and b/progress/2011FYQ1_Schedule.ods differ ----------------------------------------------------------------------- Summary of changes: progress/2011FYQ1_Schedule.ods | Bin 22147 -> 22246 bytes 1 files changed, 0 insertions(+), 0 deletions(-) hooks/post-receive -- Postgres-XC documentation |
From: Koichi S. <koi...@gm...> - 2011-04-08 00:34:51
|
Thank you for valuable advice. We also should think how GROUP BY can be pushed down to datanodes so that coordinator can simply merge the result. ---------- Koichi Suzuki 2011/4/7 Mason <ma...@us...>: > I looked at the schedule. > > I am not sure about the planned design for GROUP BY, but originally > Andrei was planning on making it somewhat similar to ORDER BY, how > ORDER BY does a merge sort on the coordinator, based on sorted results > from the data nodes. Each data node could do the beginning phase of > aggregation in groups and then sort the output in the same manner of > the groups. Then, the coordinator could do the last step of > aggregation with like groups, which is easy to get them on the fly > because of the sorting coming in from the data nodes (and avoiding > materialization). > > This should work pretty well. One drawback is if they chose a GROUP > BY clause with many groups (many = thousands+). Then some parallelism > is lost because of the final phase being done in only one place, on > the Coordinator. GridSQL spreads out the final aggregation phase > amongst all the data nodes, moving like groups to the same node to get > more parallelism. I think row shipping infrastructure might have to be > in place first before implementing that, and there will be a > noticeable benefit only once there are many, many groups, so I don't > see it being a critical thing at this phase and can be added later. > > Regards, > > Mason > > > > On Thu, Apr 7, 2011 at 5:27 AM, Koichi Suzuki > <koi...@us...> wrote: >> Project "Postgres-XC documentation". >> >> The branch, master has been updated >> via 62434399fdd57aff2701e3e5e97fed619f6d6820 (commit) >> from 252519c2be5309a3682b0ee895cf040083ae1784 (commit) >> >> >> - Log ----------------------------------------------------------------- >> commit 62434399fdd57aff2701e3e5e97fed619f6d6820 >> Author: Koichi Suzuki <koi...@gm...> >> Date: Thu Apr 7 18:27:26 2011 +0900 >> >> 1. Added 2011FYQ1 schedule for each member. >> 2. Modified my progress sheet of Reference Manual. >> >> -- Koichi Suzuki >> >> diff --git a/progress/2011FYQ1_Schedule.ods b/progress/2011FYQ1_Schedule.ods >> new file mode 100755 >> index 0000000..5e24d37 >> Binary files /dev/null and b/progress/2011FYQ1_Schedule.ods differ >> diff --git a/progress/documentation-progress.ods b/progress/documentation-progress.ods >> index 277aade..2c8577e 100644 >> Binary files a/progress/documentation-progress.ods and b/progress/documentation-progress.ods differ >> >> ----------------------------------------------------------------------- >> >> Summary of changes: >> progress/2011FYQ1_Schedule.ods | Bin 0 -> 22147 bytes >> progress/documentation-progress.ods | Bin 16883 -> 19519 bytes >> 2 files changed, 0 insertions(+), 0 deletions(-) >> create mode 100755 progress/2011FYQ1_Schedule.ods >> >> >> hooks/post-receive >> -- >> Postgres-XC documentation >> >> ------------------------------------------------------------------------------ >> Xperia(TM) PLAY >> It's a major breakthrough. An authentic gaming >> smartphone on the nation's most reliable network. >> And it wants your games. >> http://p.sf.net/sfu/verizon-sfdev >> _______________________________________________ >> Postgres-xc-committers mailing list >> Pos...@li... >> https://lists.sourceforge.net/lists/listinfo/postgres-xc-committers >> > > ------------------------------------------------------------------------------ > Xperia(TM) PLAY > It's a major breakthrough. An authentic gaming > smartphone on the nation's most reliable network. > And it wants your games. > http://p.sf.net/sfu/verizon-sfdev > _______________________________________________ > Postgres-xc-committers mailing list > Pos...@li... > https://lists.sourceforge.net/lists/listinfo/postgres-xc-committers > |