Skip to content

Commit fdd5a32

Browse files
committed
Fix some answer files for single node test
1 parent 5bda130 commit fdd5a32

40 files changed

Lines changed: 2246 additions & 1081 deletions

src/test/singlenode_regress/expected/alter_table.out

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ DROP TABLE attmp;
124124
-- fails with incorrect object type
125125
CREATE VIEW at_v1 AS SELECT 1 as a;
126126
ALTER TABLE at_v1 ALTER COLUMN a SET STATISTICS 0;
127-
ERROR: "at_v1" is not a table, materialized view, index, partitioned index, or foreign table
127+
ERROR: ALTER action ALTER COLUMN ... SET STATISTICS cannot be performed on relation "at_v1"
128+
DETAIL: This operation is not supported for views.
128129
DROP VIEW at_v1;
129130
--
130131
-- rename - check on both non-temp and temp tables
@@ -1159,9 +1160,11 @@ ERROR: column "bar" of relation "atacc1" does not exist
11591160
-- try creating a view and altering that, should fail
11601161
create view myview as select * from atacc1;
11611162
alter table myview alter column test drop not null;
1162-
ERROR: "myview" is not a table or foreign table
1163+
ERROR: ALTER action ALTER COLUMN ... DROP NOT NULL cannot be performed on relation "myview"
1164+
DETAIL: This operation is not supported for views.
11631165
alter table myview alter column test set not null;
1164-
ERROR: "myview" is not a table or foreign table
1166+
ERROR: ALTER action ALTER COLUMN ... SET NOT NULL cannot be performed on relation "myview"
1167+
DETAIL: This operation is not supported for views.
11651168
drop view myview;
11661169
drop table atacc1;
11671170
-- set not null verified by constraints
@@ -1459,7 +1462,8 @@ select * from myview;
14591462
(0 rows)
14601463

14611464
alter table myview drop d;
1462-
ERROR: "myview" is not a table, composite type, or foreign table
1465+
ERROR: ALTER action DROP COLUMN cannot be performed on relation "myview"
1466+
DETAIL: This operation is not supported for views.
14631467
drop view myview;
14641468
-- test some commands to make sure they fail on the dropped column
14651469
analyze atacc1(a);
@@ -2515,8 +2519,8 @@ create view at_view_2 as select *, to_json(v1) as j from at_view_1 v1;
25152519
id | integer | | | | plain |
25162520
stuff | text | | | | extended |
25172521
View definition:
2518-
SELECT bt.id,
2519-
bt.stuff
2522+
SELECT id,
2523+
stuff
25202524
FROM at_base_table bt;
25212525

25222526
\d+ at_view_2
@@ -2527,8 +2531,8 @@ View definition:
25272531
stuff | text | | | | extended |
25282532
j | json | | | | extended |
25292533
View definition:
2530-
SELECT v1.id,
2531-
v1.stuff,
2534+
SELECT id,
2535+
stuff,
25322536
to_json(v1.*) AS j
25332537
FROM at_view_1 v1;
25342538

@@ -2556,8 +2560,8 @@ create or replace view at_view_1 as select *, 2+2 as more from at_base_table bt;
25562560
stuff | text | | | | extended |
25572561
more | integer | | | | plain |
25582562
View definition:
2559-
SELECT bt.id,
2560-
bt.stuff,
2563+
SELECT id,
2564+
stuff,
25612565
2 + 2 AS more
25622566
FROM at_base_table bt;
25632567

@@ -2569,24 +2573,24 @@ View definition:
25692573
stuff | text | | | | extended |
25702574
j | json | | | | extended |
25712575
View definition:
2572-
SELECT v1.id,
2573-
v1.stuff,
2576+
SELECT id,
2577+
stuff,
25742578
to_json(v1.*) AS j
25752579
FROM at_view_1 v1;
25762580

25772581
explain (verbose, costs off) select * from at_view_2;
2578-
QUERY PLAN
2579-
----------------------------------------------------------------
2582+
QUERY PLAN
2583+
-----------------------------------------------------------------
25802584
Seq Scan on public.at_base_table bt
2581-
Output: bt.id, bt.stuff, to_json(ROW(bt.id, bt.stuff, NULL))
2582-
Settings: constraint_exclusion = 'partition'
2585+
Output: bt.id, bt.stuff, to_json(ROW(bt.id, bt.stuff, 4))
2586+
Settings: optimizer = 'off', constraint_exclusion = 'partition'
25832587
Optimizer: Postgres query optimizer
25842588
(4 rows)
25852589

25862590
select * from at_view_2;
2587-
id | stuff | j
2588-
----+--------+----------------------------------------
2589-
23 | skidoo | {"id":23,"stuff":"skidoo","more":null}
2591+
id | stuff | j
2592+
----+--------+-------------------------------------
2593+
23 | skidoo | {"id":23,"stuff":"skidoo","more":4}
25902594
(1 row)
25912595

25922596
drop view at_view_2;
@@ -3508,50 +3512,47 @@ ALTER TABLE old_system_table DROP COLUMN othercol;
35083512
DROP TABLE old_system_table;
35093513
-- set logged
35103514
CREATE UNLOGGED TABLE unlogged1(f1 SERIAL PRIMARY KEY, f2 TEXT);
3515+
ERROR: unlogged sequences are not supported
35113516
-- check relpersistence of an unlogged table
35123517
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1'
35133518
UNION ALL
35143519
SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^unlogged1'
35153520
UNION ALL
35163521
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'
35173522
ORDER BY relname;
3518-
relname | relkind | relpersistence
3519-
------------------+---------+----------------
3520-
toast index | i | u
3521-
toast table | t | u
3522-
unlogged1 | r | u
3523-
unlogged1_f1_seq | S | p
3524-
unlogged1_pkey | i | u
3525-
(5 rows)
3523+
relname | relkind | relpersistence
3524+
---------+---------+----------------
3525+
(0 rows)
35263526

35273527
CREATE UNLOGGED TABLE unlogged2(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged1); -- foreign key
3528-
WARNING: referential integrity (FOREIGN KEY) constraints are not supported in Apache Cloudberry, will not be enforced
3528+
ERROR: unlogged sequences are not supported
35293529
CREATE UNLOGGED TABLE unlogged3(f1 SERIAL PRIMARY KEY, f2 INTEGER REFERENCES unlogged3); -- self-referencing foreign key
3530-
WARNING: referential integrity (FOREIGN KEY) constraints are not supported in Apache Cloudberry, will not be enforced
3530+
ERROR: unlogged sequences are not supported
35313531
ALTER TABLE unlogged3 SET LOGGED; -- skip self-referencing foreign key
3532+
ERROR: relation "unlogged3" does not exist
35323533
ALTER TABLE unlogged2 SET LOGGED; -- fails because a foreign key to an unlogged table exists
3533-
ERROR: could not change table "unlogged2" to logged because it references unlogged table "unlogged1"
3534+
ERROR: relation "unlogged2" does not exist
35343535
ALTER TABLE unlogged1 SET LOGGED;
3536+
ERROR: relation "unlogged1" does not exist
35353537
-- check relpersistence of an unlogged table after changing to permanent
35363538
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged1'
35373539
UNION ALL
35383540
SELECT 'toast table', t.relkind, t.relpersistence FROM pg_class r JOIN pg_class t ON t.oid = r.reltoastrelid WHERE r.relname ~ '^unlogged1'
35393541
UNION ALL
35403542
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'
35413543
ORDER BY relname;
3542-
relname | relkind | relpersistence
3543-
------------------+---------+----------------
3544-
toast index | i | p
3545-
toast table | t | p
3546-
unlogged1 | r | p
3547-
unlogged1_f1_seq | S | p
3548-
unlogged1_pkey | i | p
3549-
(5 rows)
3544+
relname | relkind | relpersistence
3545+
---------+---------+----------------
3546+
(0 rows)
35503547

35513548
ALTER TABLE unlogged1 SET LOGGED; -- silently do nothing
3549+
ERROR: relation "unlogged1" does not exist
35523550
DROP TABLE unlogged3;
3551+
ERROR: table "unlogged3" does not exist
35533552
DROP TABLE unlogged2;
3553+
ERROR: table "unlogged2" does not exist
35543554
DROP TABLE unlogged1;
3555+
ERROR: table "unlogged1" does not exist
35553556
-- set unlogged
35563557
CREATE TABLE logged1(f1 SERIAL PRIMARY KEY, f2 TEXT);
35573558
-- check relpersistence of a permanent table
@@ -3589,7 +3590,7 @@ ORDER BY relname;
35893590
relname | relkind | relpersistence
35903591
----------------+---------+----------------
35913592
logged1 | r | u
3592-
logged1_f1_seq | S | p
3593+
logged1_f1_seq | S | u
35933594
logged1_pkey | i | u
35943595
toast index | i | u
35953596
toast table | t | u
@@ -4244,7 +4245,8 @@ DROP TABLE fail_part;
42444245
-- fails with incorrect object type
42454246
CREATE VIEW at_v1 AS SELECT 1 as a;
42464247
ALTER TABLE at_v1 ATTACH PARTITION dummy default;
4247-
ERROR: "at_v1" is not a table or partitioned index
4248+
ERROR: ALTER action ATTACH PARTITION cannot be performed on relation "at_v1"
4249+
DETAIL: This operation is not supported for views.
42484250
DROP VIEW at_v1;
42494251
--
42504252
-- DETACH PARTITION

src/test/singlenode_regress/expected/bfv_aggregate.out

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,10 +1744,9 @@ select 1, sum(col1) from group_by_const group by 1;
17441744
QUERY PLAN
17451745
-------------------------------------
17461746
GroupAggregate
1747-
Group Key: 1
17481747
-> Seq Scan on group_by_const
17491748
Optimizer: Postgres query optimizer
1750-
(4 rows)
1749+
(3 rows)
17511750

17521751
select 1, sum(col1) from group_by_const group by 1;
17531752
?column? | sum
@@ -1762,10 +1761,9 @@ select 1, median(col1) from group_by_const group by 1;
17621761
QUERY PLAN
17631762
-------------------------------------
17641763
GroupAggregate
1765-
Group Key: 1
17661764
-> Seq Scan on group_by_const
17671765
Optimizer: Postgres query optimizer
1768-
(4 rows)
1766+
(3 rows)
17691767

17701768
select 1, median(col1) from group_by_const group by 1;
17711769
?column? | median

src/test/singlenode_regress/expected/case_gp.out

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ SELECT
4343
END AS t
4444
FROM mytable;
4545
select pg_get_viewdef('notdisview2',true);
46-
pg_get_viewdef
47-
-------------------------------------------------------------------------------
48-
SELECT +
49-
CASE +
50-
WHEN mytable.c::text IS NOT DISTINCT FROM ''::text THEN 'A'::text+
51-
ELSE 'B'::text +
52-
END AS t +
46+
pg_get_viewdef
47+
-----------------------------------------------------------------------
48+
SELECT +
49+
CASE +
50+
WHEN c::text IS NOT DISTINCT FROM ''::text THEN 'A'::text+
51+
ELSE 'B'::text +
52+
END AS t +
5353
FROM mytable;
5454
(1 row)
5555

@@ -70,9 +70,9 @@ select pg_get_viewdef('notdisview3',false);
7070
pg_get_viewdef
7171
-----------------------------------------------------------------------------
7272
SELECT +
73-
CASE mytable2.key_value +
73+
CASE key_value +
7474
WHEN IS NOT DISTINCT FROM 'NULL'::text THEN ('now'::text)::date+
75-
ELSE to_date((mytable2.key_value)::text, 'YYYYMM'::text) +
75+
ELSE to_date((key_value)::text, 'YYYYMM'::text) +
7676
END AS t +
7777
FROM mytable2;
7878
(1 row)
@@ -109,18 +109,18 @@ SELECT * FROM myview ORDER BY a,b;
109109

110110
-- Test deparse
111111
select pg_get_viewdef('myview',true);
112-
pg_get_viewdef
113-
-------------------------------------------------------------------------------------
114-
SELECT mytable.a, +
115-
mytable.b, +
116-
CASE mytable.a +
117-
WHEN IS NOT DISTINCT FROM mytable.b THEN (mytable.b * 10)::numeric +
118-
WHEN IS NOT DISTINCT FROM mytable.b + 1 THEN (mytable.b * 100)::numeric+
119-
WHEN mytable.b - 1 THEN (mytable.b * 1000)::numeric +
120-
WHEN mytable.b * 10 THEN (mytable.b * 10000)::numeric +
121-
WHEN negate(mytable.b) THEN mytable.b::numeric * '-1.0'::numeric +
122-
ELSE mytable.b::numeric +
123-
END AS newb +
112+
pg_get_viewdef
113+
---------------------------------------------------------------------
114+
SELECT a, +
115+
b, +
116+
CASE a +
117+
WHEN IS NOT DISTINCT FROM b THEN (b * 10)::numeric +
118+
WHEN IS NOT DISTINCT FROM b + 1 THEN (b * 100)::numeric+
119+
WHEN b - 1 THEN (b * 1000)::numeric +
120+
WHEN b * 10 THEN (b * 10000)::numeric +
121+
WHEN negate(b) THEN b::numeric * '-1.0'::numeric +
122+
ELSE b::numeric +
123+
END AS newb +
124124
FROM mytable;
125125
(1 row)
126126

@@ -292,10 +292,10 @@ SELECT * FROM myview ORDER BY id, location;
292292
select pg_get_viewdef('myview',true);
293293
pg_get_viewdef
294294
--------------------------------------------------------------------
295-
SELECT products.id, +
296-
products.name, +
297-
products.price, +
298-
CASE products.id +
295+
SELECT id, +
296+
name, +
297+
price, +
298+
CASE id +
299299
WHEN IS NOT DISTINCT FROM 1 THEN 'Southlake'::text +
300300
WHEN IS NOT DISTINCT FROM 2 THEN 'San Francisco'::text+
301301
WHEN IS NOT DISTINCT FROM 3 THEN 'New Jersey'::text +
@@ -306,7 +306,7 @@ select pg_get_viewdef('myview',true);
306306
ELSE 'Non domestic'::text +
307307
END AS location +
308308
FROM products +
309-
WHERE products.id < 100;
309+
WHERE id < 100;
310310
(1 row)
311311

312312
-- User-defined DECODE function

0 commit comments

Comments
 (0)