citus/src/test/regress/output/multi_alter_table_statement...

716 lines
41 KiB
Plaintext

--
-- MULTI_ALTER_TABLE_STATEMENTS
--
-- Check that we can run ALTER TABLE statements on distributed tables. We
-- increase the logging verbosity to verify that commands are propagated to
-- all worker shards. We also set the shardid sequence here so that the shardids
-- in this test aren't affected by changes to the previous tests.
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 103000;
CREATE TABLE lineitem_alter (
l_orderkey bigint not null,
l_partkey integer not null,
l_suppkey integer not null,
l_linenumber integer not null,
l_quantity decimal(15, 2) not null,
l_extendedprice decimal(15, 2) not null,
l_discount decimal(15, 2) not null,
l_tax decimal(15, 2) not null,
l_returnflag char(1) not null,
l_linestatus char(1) not null,
l_shipdate date not null,
l_commitdate date not null,
l_receiptdate date not null,
l_shipinstruct char(25) not null,
l_shipmode char(10) not null,
l_comment varchar(44) not null
);
SELECT master_create_distributed_table('lineitem_alter', 'l_orderkey', 'append');
master_create_distributed_table
---------------------------------
(1 row)
\STAGE lineitem_alter FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|'
SET client_min_messages TO DEBUG2;
-- Verify that we can add columns
ALTER TABLE lineitem_alter ADD COLUMN float_column FLOAT;
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
ALTER TABLE lineitem_alter ADD COLUMN date_column DATE;
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
ALTER TABLE lineitem_alter ADD COLUMN int_column1 INTEGER DEFAULT 1;
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
DEBUG: rewriting table "lineitem_alter"
DEBUG: drop auto-cascades to type pg_temp_17666
DEBUG: drop auto-cascades to type pg_temp_17666[]
ALTER TABLE lineitem_alter ADD COLUMN int_column2 INTEGER DEFAULT 2;
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
DEBUG: rewriting table "lineitem_alter"
DEBUG: drop auto-cascades to type pg_temp_17666
DEBUG: drop auto-cascades to type pg_temp_17666[]
ALTER TABLE lineitem_alter ADD COLUMN null_column INTEGER;
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
\d lineitem_alter
Table "public.lineitem_alter"
Column | Type | Modifiers
-----------------+-----------------------+-----------
l_orderkey | bigint | not null
l_partkey | integer | not null
l_suppkey | integer | not null
l_linenumber | integer | not null
l_quantity | numeric(15,2) | not null
l_extendedprice | numeric(15,2) | not null
l_discount | numeric(15,2) | not null
l_tax | numeric(15,2) | not null
l_returnflag | character(1) | not null
l_linestatus | character(1) | not null
l_shipdate | date | not null
l_commitdate | date | not null
l_receiptdate | date | not null
l_shipinstruct | character(25) | not null
l_shipmode | character(10) | not null
l_comment | character varying(44) | not null
float_column | double precision |
date_column | date |
int_column1 | integer | default 1
int_column2 | integer | default 2
null_column | integer |
SELECT float_column, count(*) FROM lineitem_alter GROUP BY float_column;
float_column | count
--------------+-------
| 6000
(1 row)
SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1;
int_column1 | count
-------------+-------
1 | 6000
(1 row)
-- Verify that SET|DROP DEFAULT works
ALTER TABLE lineitem_alter ALTER COLUMN float_column SET DEFAULT 1;
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
ALTER TABLE lineitem_alter ALTER COLUMN int_column1 DROP DEFAULT;
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
-- \stage to verify that default values take effect
\STAGE lineitem_alter (l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment) FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|'
DEBUG: parse <unnamed>: SELECT * FROM master_get_table_metadata($1::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_table_ddl_events($1::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_new_shardid()
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_round_robin_candidate_nodes($1::int8)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_new_shardid()
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_round_robin_candidate_nodes($1::int8)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_new_shardid()
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_round_robin_candidate_nodes($1::int8)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ($1::oid, $2::int8, $3::char, $4::text, $5::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ($1::oid, $2::int8, $3::char, $4::text, $5::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ($1::oid, $2::int8, $3::char, $4::text, $5::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
SELECT float_column, count(*) FROM lineitem_alter GROUP BY float_column;
float_column | count
--------------+-------
| 6000
1 | 6000
(2 rows)
SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1;
int_column1 | count
-------------+-------
| 6000
1 | 6000
(2 rows)
-- Verify that SET NOT NULL works
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 SET NOT NULL;
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
DEBUG: verifying table "lineitem_alter"
\d lineitem_alter
Table "public.lineitem_alter"
Column | Type | Modifiers
-----------------+-----------------------+--------------------
l_orderkey | bigint | not null
l_partkey | integer | not null
l_suppkey | integer | not null
l_linenumber | integer | not null
l_quantity | numeric(15,2) | not null
l_extendedprice | numeric(15,2) | not null
l_discount | numeric(15,2) | not null
l_tax | numeric(15,2) | not null
l_returnflag | character(1) | not null
l_linestatus | character(1) | not null
l_shipdate | date | not null
l_commitdate | date | not null
l_receiptdate | date | not null
l_shipinstruct | character(25) | not null
l_shipmode | character(10) | not null
l_comment | character varying(44) | not null
float_column | double precision | default 1
date_column | date |
int_column1 | integer |
int_column2 | integer | not null default 2
null_column | integer |
-- Drop default so that NULLs will be inserted for this column
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP DEFAULT;
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
-- \stage should fail because it will try to insert NULLs for a NOT NULL column
\STAGE lineitem_alter (l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment) FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|'
DEBUG: parse <unnamed>: SELECT * FROM master_get_table_metadata($1::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_table_ddl_events($1::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_new_shardid()
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_round_robin_candidate_nodes($1::int8)
DEBUG: bind <unnamed> to <unnamed>
ERROR: null value in column "int_column2" violates not-null constraint
DETAIL: Failing row contains (1, 155190, 7706, 1, 17.00, 21168.23, 0.04, 0.02, N, O, 03-13-1996, 02-12-1996, 03-22-1996, DELIVER IN PERSON , TRUCK , egular courts above the, 1, null, null, null, null).
CONTEXT: COPY lineitem_alter_103006, line 1: "1|155190|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|DELIVER IN PERSON|TRUCK|e..."
ERROR: null value in column "int_column2" violates not-null constraint
DETAIL: Failing row contains (1, 155190, 7706, 1, 17.00, 21168.23, 0.04, 0.02, N, O, 03-13-1996, 02-12-1996, 03-22-1996, DELIVER IN PERSON , TRUCK , egular courts above the, 1, null, null, null, null).
CONTEXT: COPY lineitem_alter_103006, line 1: "1|155190|7706|1|17|21168.23|0.04|0.02|N|O|1996-03-13|1996-02-12|1996-03-22|DELIVER IN PERSON|TRUCK|e..."
\stage: failed to replicate shard to enough replicas
-- Verify that DROP NOT NULL works
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP NOT NULL;
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
\d lineitem_alter
Table "public.lineitem_alter"
Column | Type | Modifiers
-----------------+-----------------------+-----------
l_orderkey | bigint | not null
l_partkey | integer | not null
l_suppkey | integer | not null
l_linenumber | integer | not null
l_quantity | numeric(15,2) | not null
l_extendedprice | numeric(15,2) | not null
l_discount | numeric(15,2) | not null
l_tax | numeric(15,2) | not null
l_returnflag | character(1) | not null
l_linestatus | character(1) | not null
l_shipdate | date | not null
l_commitdate | date | not null
l_receiptdate | date | not null
l_shipinstruct | character(25) | not null
l_shipmode | character(10) | not null
l_comment | character varying(44) | not null
float_column | double precision | default 1
date_column | date |
int_column1 | integer |
int_column2 | integer |
null_column | integer |
-- \stage should succeed now
\STAGE lineitem_alter (l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice, l_discount, l_tax, l_returnflag, l_linestatus, l_shipdate, l_commitdate, l_receiptdate, l_shipinstruct, l_shipmode, l_comment) FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|'
DEBUG: parse <unnamed>: SELECT * FROM master_get_table_metadata($1::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_table_ddl_events($1::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_new_shardid()
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_round_robin_candidate_nodes($1::int8)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_new_shardid()
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_round_robin_candidate_nodes($1::int8)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_new_shardid()
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: SELECT * FROM master_get_round_robin_candidate_nodes($1::int8)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ($1::oid, $2::int8, $3::char, $4::text, $5::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ($1::oid, $2::int8, $3::char, $4::text, $5::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard (logicalrelid, shardid, shardstorage, shardminvalue, shardmaxvalue) VALUES ($1::oid, $2::int8, $3::char, $4::text, $5::text)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
DEBUG: parse <unnamed>: INSERT INTO pg_dist_shard_placement (shardid, shardstate, shardlength, nodename, nodeport) VALUES ($1::int8, $2::int4, $3::int8, $4::text, $5::int4)
DEBUG: bind <unnamed> to <unnamed>
SELECT count(*) from lineitem_alter;
count
-------
18000
(1 row)
-- Verify that SET DATA TYPE works
SELECT int_column2, pg_typeof(int_column2), count(*) from lineitem_alter GROUP BY int_column2;
int_column2 | pg_typeof | count
-------------+-----------+-------
| integer | 6000
2 | integer | 12000
(2 rows)
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 SET DATA TYPE FLOAT;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
DEBUG: rewriting table "lineitem_alter"
DEBUG: drop auto-cascades to type pg_temp_17666
DEBUG: drop auto-cascades to type pg_temp_17666[]
\d lineitem_alter
Table "public.lineitem_alter"
Column | Type | Modifiers
-----------------+-----------------------+-----------
l_orderkey | bigint | not null
l_partkey | integer | not null
l_suppkey | integer | not null
l_linenumber | integer | not null
l_quantity | numeric(15,2) | not null
l_extendedprice | numeric(15,2) | not null
l_discount | numeric(15,2) | not null
l_tax | numeric(15,2) | not null
l_returnflag | character(1) | not null
l_linestatus | character(1) | not null
l_shipdate | date | not null
l_commitdate | date | not null
l_receiptdate | date | not null
l_shipinstruct | character(25) | not null
l_shipmode | character(10) | not null
l_comment | character varying(44) | not null
float_column | double precision | default 1
date_column | date |
int_column1 | integer |
int_column2 | double precision |
null_column | integer |
SELECT int_column2, pg_typeof(int_column2), count(*) from lineitem_alter GROUP BY int_column2;
int_column2 | pg_typeof | count
-------------+------------------+-------
| double precision | 6000
2 | double precision | 12000
(2 rows)
-- Verify that DROP COLUMN works
ALTER TABLE lineitem_alter DROP COLUMN int_column1;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
ALTER TABLE lineitem_alter DROP COLUMN float_column;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
DEBUG: drop auto-cascades to default for table lineitem_alter column float_column
ALTER TABLE lineitem_alter DROP COLUMN date_column;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
-- Verify that IF EXISTS works as expected
ALTER TABLE non_existent_table ADD COLUMN new_column INTEGER;
ERROR: relation "non_existent_table" does not exist
ALTER TABLE IF EXISTS non_existent_table ADD COLUMN new_column INTEGER;
NOTICE: relation "non_existent_table" does not exist, skipping
ALTER TABLE IF EXISTS lineitem_alter ALTER COLUMN int_column2 SET DATA TYPE INTEGER;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
DEBUG: rewriting table "lineitem_alter"
DEBUG: drop auto-cascades to type pg_temp_17666
DEBUG: drop auto-cascades to type pg_temp_17666[]
ALTER TABLE lineitem_alter DROP COLUMN non_existent_column;
WARNING: could not receive query results from localhost:57637
DETAIL: Client error: column "non_existent_column" of relation "lineitem_alter_103009" does not exist
ERROR: could not execute DDL command on worker node shards
ALTER TABLE lineitem_alter DROP COLUMN IF EXISTS non_existent_column;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
NOTICE: column "non_existent_column" of relation "lineitem_alter" does not exist, skipping
ALTER TABLE lineitem_alter DROP COLUMN IF EXISTS int_column2;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
\d lineitem_alter
Table "public.lineitem_alter"
Column | Type | Modifiers
-----------------+-----------------------+-----------
l_orderkey | bigint | not null
l_partkey | integer | not null
l_suppkey | integer | not null
l_linenumber | integer | not null
l_quantity | numeric(15,2) | not null
l_extendedprice | numeric(15,2) | not null
l_discount | numeric(15,2) | not null
l_tax | numeric(15,2) | not null
l_returnflag | character(1) | not null
l_linestatus | character(1) | not null
l_shipdate | date | not null
l_commitdate | date | not null
l_receiptdate | date | not null
l_shipinstruct | character(25) | not null
l_shipmode | character(10) | not null
l_comment | character varying(44) | not null
null_column | integer |
-- Verify that we can execute commands with multiple subcommands
ALTER TABLE lineitem_alter ADD COLUMN int_column1 INTEGER,
ADD COLUMN int_column2 INTEGER;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
\d lineitem_alter
Table "public.lineitem_alter"
Column | Type | Modifiers
-----------------+-----------------------+-----------
l_orderkey | bigint | not null
l_partkey | integer | not null
l_suppkey | integer | not null
l_linenumber | integer | not null
l_quantity | numeric(15,2) | not null
l_extendedprice | numeric(15,2) | not null
l_discount | numeric(15,2) | not null
l_tax | numeric(15,2) | not null
l_returnflag | character(1) | not null
l_linestatus | character(1) | not null
l_shipdate | date | not null
l_commitdate | date | not null
l_receiptdate | date | not null
l_shipinstruct | character(25) | not null
l_shipmode | character(10) | not null
l_comment | character varying(44) | not null
null_column | integer |
int_column1 | integer |
int_column2 | integer |
ALTER TABLE lineitem_alter ADD COLUMN int_column3 INTEGER,
ALTER COLUMN int_column1 SET STATISTICS 10;
ERROR: alter table command is currently supported
DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT and TYPE subcommands are supported.
ALTER TABLE lineitem_alter DROP COLUMN int_column1, DROP COLUMN int_column2;
DEBUG: applied command on shard 103009 on node localhost:57637
DEBUG: applied command on shard 103009 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57638
DEBUG: applied command on shard 103008 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57637
DEBUG: applied command on shard 103007 on node localhost:57638
DEBUG: applied command on shard 103005 on node localhost:57637
DEBUG: applied command on shard 103005 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57638
DEBUG: applied command on shard 103004 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57637
DEBUG: applied command on shard 103003 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57638
DEBUG: applied command on shard 103002 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57637
DEBUG: applied command on shard 103001 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57638
DEBUG: applied command on shard 103000 on node localhost:57637
\d lineitem_alter
Table "public.lineitem_alter"
Column | Type | Modifiers
-----------------+-----------------------+-----------
l_orderkey | bigint | not null
l_partkey | integer | not null
l_suppkey | integer | not null
l_linenumber | integer | not null
l_quantity | numeric(15,2) | not null
l_extendedprice | numeric(15,2) | not null
l_discount | numeric(15,2) | not null
l_tax | numeric(15,2) | not null
l_returnflag | character(1) | not null
l_linestatus | character(1) | not null
l_shipdate | date | not null
l_commitdate | date | not null
l_receiptdate | date | not null
l_shipinstruct | character(25) | not null
l_shipmode | character(10) | not null
l_comment | character varying(44) | not null
null_column | integer |
-- Verify that we cannot execute alter commands on the distribution column
ALTER TABLE lineitem_alter ALTER COLUMN l_orderkey DROP NOT NULL;
ERROR: cannot execute ALTER TABLE command involving partition column
ALTER TABLE lineitem_alter DROP COLUMN l_orderkey;
ERROR: cannot execute ALTER TABLE command involving partition column
-- Verify that we error out on unsupported statement types
ALTER TABLE lineitem_alter ALTER COLUMN l_orderkey SET STATISTICS 100;
ERROR: alter table command is currently supported
DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT and TYPE subcommands are supported.
ALTER TABLE lineitem_alter DROP CONSTRAINT IF EXISTS non_existent_contraint;
ERROR: alter table command is currently supported
DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT and TYPE subcommands are supported.
ALTER TABLE lineitem_alter SET WITHOUT OIDS;
ERROR: alter table command is currently supported
DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT and TYPE subcommands are supported.
-- Verify that we error out in case of postgres errors on supported statement
-- types
ALTER TABLE lineitem_alter ADD COLUMN new_column non_existent_type;
WARNING: could not receive query results from localhost:57637
DETAIL: Client error: type "non_existent_type" does not exist
ERROR: could not execute DDL command on worker node shards
ALTER TABLE lineitem_alter ALTER COLUMN null_column SET NOT NULL;
WARNING: could not receive query results from localhost:57637
DETAIL: Client error: column "null_column" contains null values
ERROR: could not execute DDL command on worker node shards
ALTER TABLE lineitem_alter ALTER COLUMN l_partkey SET DEFAULT 'a';
WARNING: could not receive query results from localhost:57637
DETAIL: Client error: invalid input syntax for integer: "a"
ERROR: could not execute DDL command on worker node shards
-- Verify that we error out on statements involving RENAME
ALTER TABLE lineitem_alter RENAME TO lineitem_renamed;
ERROR: renaming distributed tables or their objects is currently unsupported
ALTER TABLE lineitem_alter RENAME COLUMN l_orderkey TO l_orderkey_renamed;
ERROR: renaming distributed tables or their objects is currently unsupported
ALTER TABLE lineitem_alter RENAME CONSTRAINT constraint_a TO constraint_b;
ERROR: renaming distributed tables or their objects is currently unsupported
-- Verify that IF EXISTS works as expected with RENAME statements
ALTER TABLE non_existent_table RENAME TO non_existent_table_renamed;
ERROR: relation "non_existent_table" does not exist
ALTER TABLE IF EXISTS non_existent_table RENAME TO non_existent_table_renamed;
NOTICE: relation "non_existent_table" does not exist, skipping
ALTER TABLE IF EXISTS non_existent_table RENAME COLUMN column1 TO column2;
NOTICE: relation "non_existent_table" does not exist, skipping
ALTER TABLE IF EXISTS lineitem_alter RENAME l_orderkey TO l_orderkey_renamed;
ERROR: renaming distributed tables or their objects is currently unsupported
-- Verify that none of the failed alter table commands took effect on the master
-- node
\d lineitem_alter
Table "public.lineitem_alter"
Column | Type | Modifiers
-----------------+-----------------------+-----------
l_orderkey | bigint | not null
l_partkey | integer | not null
l_suppkey | integer | not null
l_linenumber | integer | not null
l_quantity | numeric(15,2) | not null
l_extendedprice | numeric(15,2) | not null
l_discount | numeric(15,2) | not null
l_tax | numeric(15,2) | not null
l_returnflag | character(1) | not null
l_linestatus | character(1) | not null
l_shipdate | date | not null
l_commitdate | date | not null
l_receiptdate | date | not null
l_shipinstruct | character(25) | not null
l_shipmode | character(10) | not null
l_comment | character varying(44) | not null
null_column | integer |
-- Cleanup the table and its shards
RESET client_min_messages;
SELECT master_apply_delete_command('DELETE FROM lineitem_alter');
master_apply_delete_command
-----------------------------
9
(1 row)
DROP TABLE lineitem_alter;