Skip to content

Commit e8c44c5

Browse files
committed
Fix some answer for pax storage
1 parent f574a17 commit e8c44c5

11 files changed

Lines changed: 256 additions & 222 deletions

File tree

contrib/pax_storage/src/test/regress/expected/aggregates.out

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,14 +1895,14 @@ from generate_series(1,5) x,
18951895
(values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p)
18961896
group by p order by p;
18971897
ERROR: sum is not an ordered-set aggregate, so it cannot have WITHIN GROUP
1898-
LINE 1: select p, sum() within group (order by x::float8)
1898+
LINE 1: select p, sum() within group (order by x::float8) -- error
18991899
^
19001900
select p, percentile_cont(p,p) -- error
19011901
from generate_series(1,5) x,
19021902
(values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p)
19031903
group by p order by p;
19041904
ERROR: WITHIN GROUP is required for ordered-set aggregate percentile_cont
1905-
LINE 1: select p, percentile_cont(p,p)
1905+
LINE 1: select p, percentile_cont(p,p) -- error
19061906
^
19071907
select percentile_cont(0.5) within group (order by b) from aggtest;
19081908
percentile_cont
@@ -2094,15 +2094,15 @@ select ten,
20942094
from tenk1
20952095
group by ten order by ten;
20962096
select pg_get_viewdef('aggordview1');
2097-
pg_get_viewdef
2098-
-------------------------------------------------------------------------------------------------------------------------------
2099-
SELECT tenk1.ten, +
2100-
percentile_disc((0.5)::double precision) WITHIN GROUP (ORDER BY tenk1.thousand) AS p50, +
2101-
percentile_disc((0.5)::double precision) WITHIN GROUP (ORDER BY tenk1.thousand) FILTER (WHERE (tenk1.hundred = 1)) AS px,+
2102-
rank(5, 'AZZZZ'::name, 50) WITHIN GROUP (ORDER BY tenk1.hundred, tenk1.string4 DESC, tenk1.hundred) AS rank +
2103-
FROM tenk1 +
2104-
GROUP BY tenk1.ten +
2105-
ORDER BY tenk1.ten;
2097+
pg_get_viewdef
2098+
-------------------------------------------------------------------------------------------------------------------
2099+
SELECT ten, +
2100+
percentile_disc((0.5)::double precision) WITHIN GROUP (ORDER BY thousand) AS p50, +
2101+
percentile_disc((0.5)::double precision) WITHIN GROUP (ORDER BY thousand) FILTER (WHERE (hundred = 1)) AS px,+
2102+
rank(5, 'AZZZZ'::name, 50) WITHIN GROUP (ORDER BY hundred, string4 DESC, hundred) AS rank +
2103+
FROM tenk1 +
2104+
GROUP BY ten +
2105+
ORDER BY ten;
21062106
(1 row)
21072107

21082108
select * from aggordview1 order by ten;
@@ -2332,14 +2332,14 @@ from generate_series(1,5) x,
23322332
(values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p)
23332333
group by p order by p;
23342334
ERROR: sum is not an ordered-set aggregate, so it cannot have WITHIN GROUP
2335-
LINE 1: select p, sum() within group (order by x::float8)
2335+
LINE 1: select p, sum() within group (order by x::float8) -- error
23362336
^
23372337
select p, percentile_cont(p,p) -- error
23382338
from generate_series(1,5) x,
23392339
(values (0::float8),(0.1),(0.25),(0.4),(0.5),(0.6),(0.75),(0.9),(1)) v(p)
23402340
group by p order by p;
23412341
ERROR: WITHIN GROUP is required for ordered-set aggregate percentile_cont
2342-
LINE 1: select p, percentile_cont(p,p)
2342+
LINE 1: select p, percentile_cont(p,p) -- error
23432343
^
23442344
select percentile_cont(0.5) within group (order by b) from aggtest;
23452345
percentile_cont
@@ -2531,17 +2531,19 @@ select ten,
25312531
from tenk1
25322532
group by ten order by ten;
25332533
select pg_get_viewdef('aggordview1');
2534-
pg_get_viewdef
2535-
-------------------------------------------------------------------------------------------------------------------------------
2536-
SELECT tenk1.ten, +
2537-
percentile_disc((0.5)::double precision) WITHIN GROUP (ORDER BY tenk1.thousand) AS p50, +
2538-
percentile_disc((0.5)::double precision) WITHIN GROUP (ORDER BY tenk1.thousand) FILTER (WHERE (tenk1.hundred = 1)) AS px,+
2539-
rank(5, 'AZZZZ'::name, 50) WITHIN GROUP (ORDER BY tenk1.hundred, tenk1.string4 DESC, tenk1.hundred) AS rank +
2540-
FROM tenk1 +
2541-
GROUP BY tenk1.ten +
2542-
ORDER BY tenk1.ten;
2543-
(1 row)
2544-
2534+
pg_get_viewdef
2535+
-------------------------------------------------------------------------------------------------------------------
2536+
SELECT ten, +
2537+
percentile_disc((0.5)::double precision) WITHIN GROUP (ORDER BY thousand) AS p50, +
2538+
percentile_disc((0.5)::double precision) WITHIN GROUP (ORDER BY thousand) FILTER (WHERE (hundred = 1)) AS px,+
2539+
rank(5, 'AZZZZ'::name, 50) WITHIN GROUP (ORDER BY hundred, string4 DESC, hundred) AS rank +
2540+
FROM tenk1 +
2541+
GROUP BY ten +
2542+
ORDER BY ten;
2543+
(1 row)
2544+
2545+
-- start_ignore
2546+
-- end_ignore
25452547
select * from aggordview1 order by ten;
25462548
ten | p50 | px | rank
25472549
-----+-----+-----+------

contrib/pax_storage/src/test/regress/expected/alter_table.out

Lines changed: 41 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,9 +1171,11 @@ ERROR: column "bar" of relation "atacc1" does not exist
11711171
-- try creating a view and altering that, should fail
11721172
create view myview as select * from atacc1;
11731173
alter table myview alter column test drop not null;
1174-
ERROR: "myview" is not a table or foreign table
1174+
ERROR: ALTER action ALTER COLUMN ... DROP NOT NULL cannot be performed on relation "myview"
1175+
DETAIL: This operation is not supported for views.
11751176
alter table myview alter column test set not null;
1176-
ERROR: "myview" is not a table or foreign table
1177+
ERROR: ALTER action ALTER COLUMN ... SET NOT NULL cannot be performed on relation "myview"
1178+
DETAIL: This operation is not supported for views.
11771179
drop view myview;
11781180
drop table atacc1;
11791181
-- set not null verified by constraints
@@ -1473,7 +1475,8 @@ select * from myview;
14731475
(0 rows)
14741476

14751477
alter table myview drop d;
1476-
ERROR: "myview" is not a table, composite type, or foreign table
1478+
ERROR: ALTER action DROP COLUMN cannot be performed on relation "myview"
1479+
DETAIL: This operation is not supported for views.
14771480
drop view myview;
14781481
-- test some commands to make sure they fail on the dropped column
14791482
analyze atacc1(a);
@@ -2567,8 +2570,8 @@ create view at_view_2 as select *, to_json(v1) as j from at_view_1 v1;
25672570
id | integer | | | | plain |
25682571
stuff | text | | | | extended |
25692572
View definition:
2570-
SELECT bt.id,
2571-
bt.stuff
2573+
SELECT id,
2574+
stuff
25722575
FROM at_base_table bt;
25732576

25742577
\d+ at_view_2
@@ -2579,8 +2582,8 @@ View definition:
25792582
stuff | text | | | | extended |
25802583
j | json | | | | extended |
25812584
View definition:
2582-
SELECT v1.id,
2583-
v1.stuff,
2585+
SELECT id,
2586+
stuff,
25842587
to_json(v1.*) AS j
25852588
FROM at_view_1 v1;
25862589

@@ -2610,8 +2613,8 @@ create or replace view at_view_1 as select *, 2+2 as more from at_base_table bt;
26102613
stuff | text | | | | extended |
26112614
more | integer | | | | plain |
26122615
View definition:
2613-
SELECT bt.id,
2614-
bt.stuff,
2616+
SELECT id,
2617+
stuff,
26152618
2 + 2 AS more
26162619
FROM at_base_table bt;
26172620

@@ -2623,26 +2626,27 @@ View definition:
26232626
stuff | text | | | | extended |
26242627
j | json | | | | extended |
26252628
View definition:
2626-
SELECT v1.id,
2627-
v1.stuff,
2629+
SELECT id,
2630+
stuff,
26282631
to_json(v1.*) AS j
26292632
FROM at_view_1 v1;
26302633

26312634
explain (verbose, costs off) select * from at_view_2;
2632-
QUERY PLAN
2633-
----------------------------------------------------------------------
2635+
QUERY PLAN
2636+
-------------------------------------------------------------------
26342637
Gather Motion 3:1 (slice1; segments: 3)
2635-
Output: bt.id, bt.stuff, (to_json(ROW(bt.id, bt.stuff, NULL)))
2638+
Output: bt.id, bt.stuff, (to_json(ROW(bt.id, bt.stuff, 4)))
26362639
-> Seq Scan on public.at_base_table bt
2637-
Output: bt.id, bt.stuff, to_json(ROW(bt.id, bt.stuff, NULL))
2640+
Output: bt.id, bt.stuff, to_json(ROW(bt.id, bt.stuff, 4))
2641+
Settings: constraint_exclusion = 'partition'
26382642
Optimizer: Postgres query optimizer
26392643
Settings: constraint_exclusion=partition
26402644
(6 rows)
26412645

26422646
select * from at_view_2;
2643-
id | stuff | j
2644-
----+--------+----------------------------------------
2645-
23 | skidoo | {"id":23,"stuff":"skidoo","more":null}
2647+
id | stuff | j
2648+
----+--------+-------------------------------------
2649+
23 | skidoo | {"id":23,"stuff":"skidoo","more":4}
26462650
(1 row)
26472651

26482652
drop view at_view_2;
@@ -3502,44 +3506,47 @@ ALTER TABLE old_system_table DROP COLUMN othercol;
35023506
DROP TABLE old_system_table;
35033507
-- set logged
35043508
CREATE UNLOGGED TABLE unlogged1(f1 SERIAL PRIMARY KEY, f2 TEXT);
3509+
ERROR: unlogged sequences are not supported
35053510
-- check relpersistence of an unlogged table
35063511
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1'
35073512
UNION ALL
35083513
SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^unlogged1'
35093514
UNION ALL
35103515
SELECT 'toast index', ri.relkind, ri.relpersistence FROM pg_class r join pg_class t ON t.oid = r.reltoastrelid JOIN pg_index i ON i.indrelid = t.oid JOIN pg_class ri ON ri.oid = i.indexrelid WHERE r.relname ~ '^unlogged1'
35113516
ORDER BY relname;
3512-
relname | relkind | relpersistence
3513-
------------------+---------+----------------
3514-
unlogged1 | r | u
3515-
unlogged1_f1_seq | S | p
3516-
unlogged1_pkey | i | u
3517-
(3 rows)
3517+
relname | relkind | relpersistence
3518+
---------+---------+----------------
3519+
(0 rows)
35183520

35193521
CREATE UNLOGGED TABLE unlogged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged1); -- foreign key
3522+
ERROR: unlogged sequences are not supported
35203523
CREATE UNLOGGED TABLE unlogged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged3); -- self-referencing foreign key
3524+
ERROR: unlogged sequences are not supported
35213525
ALTER TABLE unlogged3 SET LOGGED; -- skip self-referencing foreign key
3526+
ERROR: relation "unlogged3" does not exist
35223527
ALTER TABLE unlogged2 SET LOGGED; -- fails because a foreign key to an unlogged table exists
3523-
ERROR: could not change table "unlogged2" to logged because it references unlogged table "unlogged1"
3528+
ERROR: relation "unlogged2" does not exist
35243529
ALTER TABLE unlogged1 SET LOGGED;
3530+
ERROR: relation "unlogged1" does not exist
35253531
-- check relpersistence of an unlogged table after changing to permanent
35263532
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1'
35273533
UNION ALL
35283534
SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^unlogged1'
35293535
UNION ALL
35303536
SELECT 'toast index', ri.relkind, ri.relpersistence FROM pg_class r join pg_class t ON t.oid = r.reltoastrelid JOIN pg_index i ON i.indrelid = t.oid JOIN pg_class ri ON ri.oid = i.indexrelid WHERE r.relname ~ '^unlogged1'
35313537
ORDER BY relname;
3532-
relname | relkind | relpersistence
3533-
------------------+---------+----------------
3534-
unlogged1 | r | p
3535-
unlogged1_f1_seq | S | p
3536-
unlogged1_pkey | i | p
3537-
(3 rows)
3538+
relname | relkind | relpersistence
3539+
---------+---------+----------------
3540+
(0 rows)
35383541

35393542
ALTER TABLE unlogged1 SET LOGGED; -- silently do nothing
3543+
ERROR: relation "unlogged1" does not exist
35403544
DROP TABLE unlogged3;
3545+
ERROR: table "unlogged3" does not exist
35413546
DROP TABLE unlogged2;
3547+
ERROR: table "unlogged2" does not exist
35423548
DROP TABLE unlogged1;
3549+
ERROR: table "unlogged1" does not exist
35433550
-- set unlogged
35443551
CREATE TABLE logged1(f1 SERIAL PRIMARY KEY, f2 TEXT);
35453552
-- check relpersistence of a permanent table
@@ -3573,7 +3580,7 @@ ORDER BY relname;
35733580
relname | relkind | relpersistence
35743581
----------------+---------+----------------
35753582
logged1 | r | u
3576-
logged1_f1_seq | S | p
3583+
logged1_f1_seq | S | u
35773584
logged1_pkey | i | u
35783585
(3 rows)
35793586

@@ -4240,7 +4247,8 @@ DROP TABLE fail_part;
42404247
-- fails with incorrect object type
42414248
CREATE VIEW at_v1 AS SELECT 1 as a;
42424249
ALTER TABLE at_v1 ATTACH PARTITION dummy default;
4243-
ERROR: "at_v1" is not a table or partitioned index
4250+
ERROR: ALTER action ATTACH PARTITION cannot be performed on relation "at_v1"
4251+
DETAIL: This operation is not supported for views.
42444252
DROP VIEW at_v1;
42454253
--
42464254
-- DETACH PARTITION

contrib/pax_storage/src/test/regress/expected/cluster.out

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,6 @@ CREATE INDEX clstrpart_idx ON clstrpart (a);
451451
ALTER TABLE clstrpart CLUSTER ON clstrpart_idx;
452452
ERROR: cannot mark index clustered in partitioned table
453453
CLUSTER clstrpart USING clstrpart_idx;
454-
ERROR: cannot cluster a partitioned table
455454
DROP TABLE clstrpart;
456455
-- Test CLUSTER with external tuplesorting
457456
-- The tests assume that the rows come out in the physical order, as

contrib/pax_storage/src/test/regress/expected/indexing.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,8 @@ select relname, relpartbound from pg_class
143143
(2 rows)
144144

145145
alter table idxpart_c detach partition idxpart1_c;
146-
ERROR: "idxpart_c" is not a table
146+
ERROR: ALTER action DETACH PARTITION cannot be performed on relation "idxpart_c"
147+
DETAIL: This operation is not supported for partitioned indexes.
147148
drop table idxpart;
148149
-- If a partition already has an index, don't create a duplicative one
149150
create table idxpart (a int, b int) partition by range (a, b);

contrib/pax_storage/src/test/regress/expected/join.out

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ SELECT * FROM (J1_TBL JOIN J2_TBL USING (i)) AS x WHERE J1_TBL.t = 'one'; -- er
16381638
ERROR: invalid reference to FROM-clause entry for table "j1_tbl"
16391639
LINE 1: ... * FROM (J1_TBL JOIN J2_TBL USING (i)) AS x WHERE J1_TBL.t =...
16401640
^
1641-
HINT: There is an entry for table "j1_tbl", but it cannot be referenced from this part of the query.
1641+
DETAIL: There is an entry for table "j1_tbl", but it cannot be referenced from this part of the query.
16421642
SELECT * FROM J1_TBL JOIN J2_TBL USING (i) AS x WHERE x.i = 1; -- ok
16431643
i | j | t | k
16441644
---+---+-----+----
@@ -4787,36 +4787,31 @@ explain (costs off)
47874787
QUERY PLAN
47884788
-------------------------------------------------------------
47894789
Gather Motion 3:1 (slice1; segments: 3)
4790-
-> Hash Right Join
4791-
Hash Cond: (b.unique2 = a.f1)
4792-
-> Redistribute Motion 3:3 (slice2; segments: 3)
4793-
Hash Key: 0
4794-
-> Index Scan using tenk1_unique2 on tenk1 b
4795-
Index Cond: (unique2 = 0)
4796-
-> Hash
4797-
-> Seq Scan on int4_tbl a
4798-
Filter: (f1 = 0)
4790+
-> Nested Loop Left Join
4791+
-> Seq Scan on int4_tbl a
4792+
Filter: (f1 = 0)
4793+
-> Materialize
4794+
-> Redistribute Motion 3:3 (slice2; segments: 3)
4795+
Hash Key: 0
4796+
-> Index Scan using tenk1_unique2 on tenk1 b
4797+
Index Cond: (unique2 = 0)
47994798
Optimizer: Postgres query optimizer
48004799
(11 rows)
48014800

48024801
explain (costs off)
48034802
select * from tenk1 a full join tenk1 b using(unique2) where unique2 = 42;
4804-
QUERY PLAN
4805-
-------------------------------------------------------------------
4806-
Gather Motion 3:1 (slice1; segments: 3)
4807-
-> Hash Full Join
4808-
Hash Cond: (a.unique2 = b.unique2)
4809-
-> Redistribute Motion 3:3 (slice2; segments: 3)
4810-
Hash Key: a.unique2
4811-
-> Index Scan using tenk1_unique2 on tenk1 a
4803+
QUERY PLAN
4804+
-------------------------------------------------------------
4805+
Merge Full Join
4806+
-> Gather Motion 3:1 (slice1; segments: 3)
4807+
-> Index Scan using tenk1_unique2 on tenk1 a
4808+
Index Cond: (unique2 = 42)
4809+
-> Materialize
4810+
-> Gather Motion 3:1 (slice2; segments: 3)
4811+
-> Index Scan using tenk1_unique2 on tenk1 b
48124812
Index Cond: (unique2 = 42)
4813-
-> Hash
4814-
-> Redistribute Motion 3:3 (slice3; segments: 3)
4815-
Hash Key: b.unique2
4816-
-> Index Scan using tenk1_unique2 on tenk1 b
4817-
Index Cond: (unique2 = 42)
48184813
Optimizer: Postgres query optimizer
4819-
(13 rows)
4814+
(9 rows)
48204815

48214816
--
48224817
-- test that quals attached to an outer join have correct semantics,
@@ -5322,7 +5317,7 @@ select * from
53225317
ERROR: invalid reference to FROM-clause entry for table "y"
53235318
LINE 2: ...bl x join (int4_tbl x cross join int4_tbl y) j on q1 = y.f1;
53245319
^
5325-
HINT: There is an entry for table "y", but it cannot be referenced from this part of the query.
5320+
DETAIL: There is an entry for table "y", but it cannot be referenced from this part of the query.
53265321
select * from
53275322
int8_tbl x join (int4_tbl x cross join int4_tbl y(ff)) j on q1 = f1; -- ok
53285323
q1 | q2 | f1 | ff
@@ -6609,8 +6604,8 @@ select * from fkest f1
66096604
join fkest f2 on (f1.x = f2.x and f1.x10 = f2.x10b and f1.x100 = f2.x100)
66106605
join fkest f3 on f1.x = f3.x
66116606
where f1.x100 = 2;
6612-
QUERY PLAN
6613-
-----------------------------------------------------
6607+
QUERY PLAN
6608+
-----------------------------------------------------------
66146609
Gather Motion 3:1 (slice1; segments: 3)
66156610
-> Hash Join
66166611
Hash Cond: ((f1.x = f2.x) AND (f1.x10 = f2.x10b))
@@ -6676,7 +6671,7 @@ where f.c = 1;
66766671
-> Index Only Scan using fkest1_pkey on fkest1 f3
66776672
Index Cond: ((a = f.a) AND (b = f.b))
66786673
Optimizer: Postgres query optimizer
6679-
(13 rows)
6674+
(19 rows)
66806675

66816676
rollback;
66826677
--
@@ -7185,13 +7180,13 @@ from onek t1, tenk1 t2
71857180
where exists (select 1 from j3
71867181
where j3.unique1 = t1.unique1 and j3.tenthous = t2.hundred)
71877182
and t1.unique1 < 1;
7188-
QUERY PLAN
7189-
----------------------------------------------------------------------------------------------------------------------
7183+
QUERY PLAN
7184+
---------------------------------------------------------------------------------------------------------------------------------------
71907185
Gather Motion 3:1 (slice1; segments: 3)
71917186
Output: t1.unique1, t2.hundred
71927187
-> Nested Loop
71937188
Output: t1.unique1, t2.hundred
7194-
Join Filter: (j3.unique1 = t1.unique1)
7189+
Join Filter: (t1.unique1 = j3.unique1)
71957190
-> Broadcast Motion 3:3 (slice2; segments: 3)
71967191
Output: t1.unique1
71977192
-> Index Only Scan using onek_unique1 on public.onek t1

0 commit comments

Comments
 (0)