Remove dynamic translation of regression test scripts, step 1.

This commit is inspired by a commit
d1029bb5a26cb84b116b0dee4dde312291359f2a from PostgreSQL 15 that shares
the same header.

--------------------

Below is the commit message from PostgreSQL 15 commit
d1029bb5a26cb84b116b0dee4dde312291359f2a :

pg_regress has long had provisions for dynamically substituting path
names into regression test scripts and result files, but use of that
feature has always been a serious pain in the neck, mainly because
updating the result files requires tedious manual editing.  Let's
get rid of that in favor of passing down the paths in environment
variables.

In addition to being easier to maintain, this way is capable of
dealing with path names that require escaping at runtime, for example
paths containing single-quote marks.  (There are other stumbling
blocks in the way of actually building in a path that looks like
that, but removing this one seems like a good thing to do.)  The key
coding rule that makes that possible is to concatenate pieces of a
dynamically-variable string using psql's \set command, and then use
the :'variable' notation to quote and escape the string for the next
level of interpretation.

In hopes of making this change more transparent to "git blame",
I've split it into two steps.  This commit adds the necessary
pg_regress.c support and changes all the *.source files in-place
so that they no longer require any dynamic translation.  The next
commit will just "git mv" them into the regular sql/ and expected/
directories.

Discussion: https://postgr.es/m/1655733.1639871614@sss.pgh.pa.us
pull/6138/head
Hanefi Onaldi 2022-08-06 02:44:18 +03:00
parent 4185543910
commit b6bd9ab87b
No known key found for this signature in database
GPG Key ID: F18CDB10BA0DFDC7
38 changed files with 1080 additions and 886 deletions

View File

@ -6,7 +6,8 @@ CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
USING columnar; USING columnar;
-- load table data from file -- load table data from file
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV; \set contestants_1_csv_file :abs_srcdir '/data/contestants.1.csv'
COPY test_contestant FROM :'contestants_1_csv_file' WITH CSV;
-- export using COPY table TO ... -- export using COPY table TO ...
COPY test_contestant TO STDOUT; COPY test_contestant TO STDOUT;

View File

@ -13,7 +13,8 @@ SET intervalstyle TO 'POSTGRES_VERBOSE';
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[], CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
text_array text[]) USING columnar; text_array text[]) USING columnar;
COPY test_array_types FROM '@abs_srcdir@/data/array_types.csv' WITH CSV; \set array_types_csv_file :abs_srcdir '/data/array_types.csv'
COPY test_array_types FROM :'array_types_csv_file' WITH CSV;
SELECT * FROM test_array_types; SELECT * FROM test_array_types;
@ -23,7 +24,8 @@ CREATE TABLE test_datetime_types (timestamp timestamp,
timestamp_with_timezone timestamp with time zone, date date, time time, timestamp_with_timezone timestamp with time zone, date date, time time,
interval interval) USING columnar; interval interval) USING columnar;
COPY test_datetime_types FROM '@abs_srcdir@/data/datetime_types.csv' WITH CSV; \set datetime_types_csv_file :abs_srcdir '/data/datetime_types.csv'
COPY test_datetime_types FROM :'datetime_types_csv_file' WITH CSV;
SELECT * FROM test_datetime_types; SELECT * FROM test_datetime_types;
@ -35,8 +37,9 @@ CREATE TYPE composite_type AS (a int, b text);
CREATE TABLE test_enum_and_composite_types (enum enum_type, CREATE TABLE test_enum_and_composite_types (enum enum_type,
composite composite_type) USING columnar; composite composite_type) USING columnar;
\set enum_and_composite_types_csv_file :abs_srcdir '/data/enum_and_composite_types.csv'
COPY test_enum_and_composite_types FROM COPY test_enum_and_composite_types FROM
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV; :'enum_and_composite_types_csv_file' WITH CSV;
SELECT * FROM test_enum_and_composite_types; SELECT * FROM test_enum_and_composite_types;
@ -45,7 +48,8 @@ SELECT * FROM test_enum_and_composite_types;
CREATE TABLE test_range_types (int4range int4range, int8range int8range, CREATE TABLE test_range_types (int4range int4range, int8range int8range,
numrange numrange, tsrange tsrange) USING columnar; numrange numrange, tsrange tsrange) USING columnar;
COPY test_range_types FROM '@abs_srcdir@/data/range_types.csv' WITH CSV; \set range_types_csv_file :abs_srcdir '/data/range_types.csv'
COPY test_range_types FROM :'range_types_csv_file' WITH CSV;
SELECT * FROM test_range_types; SELECT * FROM test_range_types;
@ -54,7 +58,8 @@ SELECT * FROM test_range_types;
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money, CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
inet inet, bitstring bit varying(5), uuid uuid, json json) USING columnar; inet inet, bitstring bit varying(5), uuid uuid, json json) USING columnar;
COPY test_other_types FROM '@abs_srcdir@/data/other_types.csv' WITH CSV; \set other_types_csv_file :abs_srcdir '/data/other_types.csv'
COPY test_other_types FROM :'other_types_csv_file' WITH CSV;
SELECT * FROM test_other_types; SELECT * FROM test_other_types;
@ -63,7 +68,8 @@ SELECT * FROM test_other_types;
CREATE TABLE test_null_values (a int, b int[], c composite_type) CREATE TABLE test_null_values (a int, b int[], c composite_type)
USING columnar; USING columnar;
COPY test_null_values FROM '@abs_srcdir@/data/null_values.csv' WITH CSV; \set null_values_csv_file :abs_srcdir '/data/null_values.csv'
COPY test_null_values FROM :'null_values_csv_file' WITH CSV;
SELECT * FROM test_null_values; SELECT * FROM test_null_values;

View File

@ -3,27 +3,29 @@
-- --
-- COPY with incorrect delimiter -- COPY with incorrect delimiter
COPY contestant FROM '@abs_srcdir@/data/contestants.1.csv' \set contestants_1_csv_file :abs_srcdir '/data/contestants.1.csv'
COPY contestant FROM :'contestants_1_csv_file'
WITH DELIMITER '|'; -- ERROR WITH DELIMITER '|'; -- ERROR
-- COPY with invalid program -- COPY with invalid program
COPY contestant FROM PROGRAM 'invalid_program' WITH CSV; -- ERROR COPY contestant FROM PROGRAM 'invalid_program' WITH CSV; -- ERROR
-- COPY into uncompressed table from file -- COPY into uncompressed table from file
COPY contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV; COPY contestant FROM :'contestants_1_csv_file' WITH CSV;
-- COPY into uncompressed table from program -- COPY into uncompressed table from program
COPY contestant FROM PROGRAM 'cat @abs_srcdir@/data/contestants.2.csv' WITH CSV; \set cat_contestants_2_csv_file 'cat ' :abs_srcdir '/data/contestants.2.csv'
COPY contestant FROM PROGRAM :'cat_contestants_2_csv_file' WITH CSV;
select select
version_major, version_minor, reserved_stripe_id, reserved_row_number version_major, version_minor, reserved_stripe_id, reserved_row_number
from columnar_test_helpers.columnar_storage_info('contestant'); from columnar_test_helpers.columnar_storage_info('contestant');
-- COPY into compressed table -- COPY into compressed table
COPY contestant_compressed FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV; COPY contestant_compressed FROM :'contestants_1_csv_file' WITH CSV;
-- COPY into uncompressed table from program -- COPY into uncompressed table from program
COPY contestant_compressed FROM PROGRAM 'cat @abs_srcdir@/data/contestants.2.csv' COPY contestant_compressed FROM PROGRAM :'cat_contestants_2_csv_file'
WITH CSV; WITH CSV;
select select

View File

@ -82,11 +82,16 @@ SELECT create_distributed_table('ads', 'company_id');
SELECT create_distributed_table('clicks', 'company_id'); SELECT create_distributed_table('clicks', 'company_id');
SELECT create_distributed_table('impressions', 'company_id'); SELECT create_distributed_table('impressions', 'company_id');
\copy companies from '@abs_srcdir@/data/companies.csv' with csv \set companies_csv_file :abs_srcdir '/data/companies.csv'
\copy campaigns from '@abs_srcdir@/data/campaigns.csv' with csv \set campaigns_csv_file :abs_srcdir '/data/campaigns.csv'
\copy ads from '@abs_srcdir@/data/ads.csv' with csv \set ads_csv_file :abs_srcdir '/data/ads.csv'
\copy clicks from '@abs_srcdir@/data/clicks.csv' with csv \set clicks_csv_file :abs_srcdir '/data/clicks.csv'
\copy impressions from '@abs_srcdir@/data/impressions.csv' with csv \set impressions_csv_file :abs_srcdir '/data/impressions.csv'
COPY companies from :'companies_csv_file' with csv;
COPY campaigns from :'campaigns_csv_file' with csv;
COPY ads from :'ads_csv_file' with csv;
COPY clicks from :'clicks_csv_file' with csv;
COPY impressions from :'impressions_csv_file' with csv;
SELECT a.campaign_id, SELECT a.campaign_id,
RANK() OVER ( RANK() OVER (
@ -174,11 +179,11 @@ CREATE TABLE impressions (
REFERENCES ads (company_id, id) REFERENCES ads (company_id, id)
); );
\copy companies from '@abs_srcdir@/data/companies.csv' with csv COPY companies from :'companies_csv_file' with csv;
\copy campaigns from '@abs_srcdir@/data/campaigns.csv' with csv COPY campaigns from :'campaigns_csv_file' with csv;
\copy ads from '@abs_srcdir@/data/ads.csv' with csv COPY ads from :'ads_csv_file' with csv;
\copy clicks from '@abs_srcdir@/data/clicks.csv' with csv COPY clicks from :'clicks_csv_file' with csv;
\copy impressions from '@abs_srcdir@/data/impressions.csv' with csv COPY impressions from :'impressions_csv_file' with csv;
SELECT create_distributed_table('companies', 'id'); SELECT create_distributed_table('companies', 'id');
SELECT create_distributed_table('campaigns', 'company_id'); SELECT create_distributed_table('campaigns', 'company_id');

View File

@ -34,8 +34,10 @@ SELECT master_create_empty_shard('lineitem_range') AS new_shard_id
UPDATE pg_dist_shard SET shardminvalue = 8997, shardmaxvalue = 14947 UPDATE pg_dist_shard SET shardminvalue = 8997, shardmaxvalue = 14947
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
\copy lineitem_range FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem_range FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
COPY lineitem_range FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem_range FROM :'lineitem_2_data_file' with delimiter '|';
-- Run aggregate(distinct) on partition column for range partitioned table -- Run aggregate(distinct) on partition column for range partitioned table
@ -93,8 +95,8 @@ CREATE TABLE lineitem_hash (
SET citus.shard_replication_factor TO 1; SET citus.shard_replication_factor TO 1;
SELECT create_distributed_table('lineitem_hash', 'l_orderkey', 'hash'); SELECT create_distributed_table('lineitem_hash', 'l_orderkey', 'hash');
\copy lineitem_hash FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' COPY lineitem_hash FROM :'lineitem_1_data_file' with delimiter '|';
\copy lineitem_hash FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' COPY lineitem_hash FROM :'lineitem_2_data_file' with delimiter '|';
-- aggregate(distinct) on partition column is allowed -- aggregate(distinct) on partition column is allowed
SELECT count(distinct l_orderkey) FROM lineitem_hash; SELECT count(distinct l_orderkey) FROM lineitem_hash;

View File

@ -20,7 +20,8 @@ CREATE TABLE aggregate_type (
SELECT create_distributed_table('aggregate_type', 'float_value', 'append'); SELECT create_distributed_table('aggregate_type', 'float_value', 'append');
SELECT master_create_empty_shard('aggregate_type') AS shardid \gset SELECT master_create_empty_shard('aggregate_type') AS shardid \gset
copy aggregate_type FROM '@abs_srcdir@/data/agg_type.data' with (append_to_shard :shardid); \set agg_type_data_file :abs_srcdir '/data/agg_type.data'
copy aggregate_type FROM :'agg_type_data_file' with (append_to_shard :shardid);
-- Test conversions using aggregates on floats and division -- Test conversions using aggregates on floats and division

View File

@ -29,7 +29,8 @@ CREATE TABLE lineitem_alter (
WITH ( fillfactor = 80 ); WITH ( fillfactor = 80 );
SELECT create_distributed_table('lineitem_alter', 'l_orderkey', 'append'); SELECT create_distributed_table('lineitem_alter', 'l_orderkey', 'append');
SELECT master_create_empty_shard('lineitem_alter') AS shardid \gset SELECT master_create_empty_shard('lineitem_alter') AS shardid \gset
copy lineitem_alter FROM '@abs_srcdir@/data/lineitem.1.data' with (delimiter '|', append_to_shard :shardid); \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
copy lineitem_alter FROM :'lineitem_1_data_file' with (delimiter '|', append_to_shard :shardid);
-- verify that the storage options made it to the table definitions -- verify that the storage options made it to the table definitions
SELECT relname, reloptions FROM pg_class WHERE relname = 'lineitem_alter'; SELECT relname, reloptions FROM pg_class WHERE relname = 'lineitem_alter';
@ -64,9 +65,9 @@ SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1;
ALTER TABLE lineitem_alter ALTER COLUMN float_column SET DEFAULT 1; ALTER TABLE lineitem_alter ALTER COLUMN float_column SET DEFAULT 1;
ALTER TABLE lineitem_alter ALTER COLUMN int_column1 DROP DEFAULT; ALTER TABLE lineitem_alter ALTER COLUMN int_column1 DROP DEFAULT;
-- \copy to verify that default values take effect -- COPY to verify that default values take effect
SELECT master_create_empty_shard('lineitem_alter') as shardid \gset SELECT master_create_empty_shard('lineitem_alter') as shardid \gset
copy 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 '|', append_to_shard :shardid); copy 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 :'lineitem_1_data_file' with (delimiter '|', append_to_shard :shardid);
SELECT float_column, count(*) FROM lineitem_alter GROUP BY float_column; SELECT float_column, count(*) FROM lineitem_alter GROUP BY float_column;
SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1; SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1;
@ -79,11 +80,11 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineite
-- Drop default so that NULLs will be inserted for this column -- Drop default so that NULLs will be inserted for this column
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP DEFAULT; ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP DEFAULT;
-- \copy should fail because it will try to insert NULLs for a NOT NULL column -- COPY should fail because it will try to insert NULLs for a NOT NULL column
-- Note, this operation will create a table on the workers but it won't be in the metadata -- Note, this operation will create a table on the workers but it won't be in the metadata
BEGIN; BEGIN;
SELECT master_create_empty_shard('lineitem_alter') as shardid \gset SELECT master_create_empty_shard('lineitem_alter') as shardid \gset
copy 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 '|', append_to_shard :shardid); copy 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 :'lineitem_1_data_file' with (delimiter '|', append_to_shard :shardid);
END; END;
-- Verify that DROP NOT NULL works -- Verify that DROP NOT NULL works
@ -91,9 +92,9 @@ END;
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP NOT NULL; ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP NOT NULL;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
-- \copy should succeed now -- COPY should succeed now
SELECT master_create_empty_shard('lineitem_alter') as shardid \gset SELECT master_create_empty_shard('lineitem_alter') as shardid \gset
copy 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 '|', append_to_shard :shardid); copy 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 :'lineitem_1_data_file' with (delimiter '|', append_to_shard :shardid);
SELECT count(*) from lineitem_alter; SELECT count(*) from lineitem_alter;
-- Verify that SET DATA TYPE works -- Verify that SET DATA TYPE works
@ -516,7 +517,8 @@ DROP TABLE trigger_table;
-- test ALTER TABLE ALL IN TABLESPACE -- test ALTER TABLE ALL IN TABLESPACE
-- we expect that it will warn out -- we expect that it will warn out
CREATE TABLESPACE super_fast_ssd LOCATION '@abs_srcdir@/data'; \set tablespace_location :abs_srcdir '/data'
CREATE TABLESPACE super_fast_ssd LOCATION :'tablespace_location';
ALTER TABLE ALL IN TABLESPACE pg_default SET TABLESPACE super_fast_ssd; ALTER TABLE ALL IN TABLESPACE pg_default SET TABLESPACE super_fast_ssd;
ALTER TABLE ALL IN TABLESPACE super_fast_ssd SET TABLESPACE pg_default; ALTER TABLE ALL IN TABLESPACE super_fast_ssd SET TABLESPACE pg_default;
DROP TABLESPACE super_fast_ssd; DROP TABLESPACE super_fast_ssd;

View File

@ -15,8 +15,10 @@ SELECT create_distributed_table('users_table', 'user_id');
CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint); CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint);
SELECT create_distributed_table('events_table', 'user_id'); SELECT create_distributed_table('events_table', 'user_id');
\COPY users_table FROM '@abs_srcdir@/data/users_table.data' WITH CSV; \set users_table_data_file :abs_srcdir '/data/users_table.data'
\COPY events_table FROM '@abs_srcdir@/data/events_table.data' WITH CSV; \set events_table_data_file :abs_srcdir '/data/events_table.data'
COPY users_table FROM :'users_table_data_file' WITH CSV;
COPY events_table FROM :'events_table_data_file' WITH CSV;
SET citus.shard_count = 96; SET citus.shard_count = 96;
CREATE SCHEMA subquery_and_ctes; CREATE SCHEMA subquery_and_ctes;
@ -28,8 +30,8 @@ SELECT create_distributed_table('users_table', 'user_id');
CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint); CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint);
SELECT create_distributed_table('events_table', 'user_id'); SELECT create_distributed_table('events_table', 'user_id');
\COPY users_table FROM '@abs_srcdir@/data/users_table.data' WITH CSV; COPY users_table FROM :'users_table_data_file' WITH CSV;
\COPY events_table FROM '@abs_srcdir@/data/events_table.data' WITH CSV; COPY events_table FROM :'events_table_data_file' WITH CSV;
SET citus.shard_count TO DEFAULT; SET citus.shard_count TO DEFAULT;
SET search_path TO DEFAULT; SET search_path TO DEFAULT;
@ -68,8 +70,8 @@ INSERT INTO users_ref_test_table VALUES(4,'User_4',48);
INSERT INTO users_ref_test_table VALUES(5,'User_5',49); INSERT INTO users_ref_test_table VALUES(5,'User_5',49);
INSERT INTO users_ref_test_table VALUES(6,'User_6',50); INSERT INTO users_ref_test_table VALUES(6,'User_6',50);
\COPY users_table FROM '@abs_srcdir@/data/users_table.data' WITH CSV; COPY users_table FROM :'users_table_data_file' WITH CSV;
\COPY events_table FROM '@abs_srcdir@/data/events_table.data' WITH CSV; COPY events_table FROM :'events_table_data_file' WITH CSV;
-- create indexes for -- create indexes for
CREATE INDEX is_index1 ON users_table(user_id); CREATE INDEX is_index1 ON users_table(user_id);

View File

@ -163,7 +163,7 @@ SELECT master_create_empty_shard('events') AS new_shard_id
UPDATE pg_dist_shard SET shardminvalue = '(2,2000000001)', shardmaxvalue = '(2,4300000000)' UPDATE pg_dist_shard SET shardminvalue = '(2,2000000001)', shardmaxvalue = '(2,4300000000)'
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
\COPY events FROM STDIN WITH CSV COPY events FROM STDIN WITH CSV;
"(1,1001)",20001,click,1472807012 "(1,1001)",20001,click,1472807012
"(1,1001)",20002,submit,1472807015 "(1,1001)",20002,submit,1472807015
"(1,1001)",20003,pay,1472807020 "(1,1001)",20003,pay,1472807020
@ -207,7 +207,7 @@ SELECT master_create_empty_shard('users') AS new_shard_id
UPDATE pg_dist_shard SET shardminvalue = '(2,2000000001)', shardmaxvalue = '(2,4300000000)' UPDATE pg_dist_shard SET shardminvalue = '(2,2000000001)', shardmaxvalue = '(2,4300000000)'
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
\COPY users FROM STDIN WITH CSV COPY users FROM STDIN WITH CSV;
"(1,1001)",1472807115 "(1,1001)",1472807115
"(1,1002)",1472807215 "(1,1002)",1472807215
"(1,1003)",1472807315 "(1,1003)",1472807315
@ -290,8 +290,12 @@ SELECT master_create_empty_shard('orders_subquery') AS new_shard_id
UPDATE pg_dist_shard SET shardminvalue = 8997, shardmaxvalue = 14947 UPDATE pg_dist_shard SET shardminvalue = 8997, shardmaxvalue = 14947
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
\copy lineitem_subquery FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem_subquery FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' COPY lineitem_subquery FROM :'lineitem_1_data_file' with delimiter '|';
\set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
COPY lineitem_subquery FROM :'lineitem_2_data_file' with delimiter '|';
\copy orders_subquery FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\copy orders_subquery FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' COPY orders_subquery FROM :'orders_1_data_file' with delimiter '|';
\set orders_2_data_file :abs_srcdir '/data/orders.2.data'
COPY orders_subquery FROM :'orders_2_data_file' with delimiter '|';

View File

@ -29,8 +29,10 @@ CREATE TABLE lineitem_hash (
SELECT create_distributed_table('lineitem_hash', 'l_orderkey', 'hash'); SELECT create_distributed_table('lineitem_hash', 'l_orderkey', 'hash');
\copy lineitem_hash FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem_hash FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
COPY lineitem_hash FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem_hash FROM :'lineitem_2_data_file' with delimiter '|';
ANALYZE lineitem_hash; ANALYZE lineitem_hash;

View File

@ -2,6 +2,11 @@
-- MULTI_COPY -- MULTI_COPY
-- --
-- set file paths
\set customer1datafile :abs_srcdir '/data/customer.1.data'
\set customer2datafile :abs_srcdir '/data/customer.2.data'
\set customer3datafile :abs_srcdir '/data/customer.3.data'
\set lineitem1datafile :abs_srcdir '/data/lineitem.1.data'
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 560000; ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 560000;
@ -97,13 +102,17 @@ WITH (DELIMITER ' ');
SELECT count(*) FROM customer_copy_hash WHERE c_custkey = 9; SELECT count(*) FROM customer_copy_hash WHERE c_custkey = 9;
-- Test server-side copy from file -- Test server-side copy from file
COPY customer_copy_hash FROM '@abs_srcdir@/data/customer.2.data' WITH (DELIMITER '|'); COPY customer_copy_hash FROM :'customer2datafile' WITH (DELIMITER '|');
-- Confirm that data was copied -- Confirm that data was copied
SELECT count(*) FROM customer_copy_hash; SELECT count(*) FROM customer_copy_hash;
-- Test client-side copy from file -- Test client-side copy from file
\copy customer_copy_hash FROM '@abs_srcdir@/data/customer.3.data' WITH (DELIMITER '|'); -- \copy does not support variable interpolation. Hence we store and execute
-- the query in two steps for interpolation to kick in.
-- See https://stackoverflow.com/a/67642094/4576416 for details.
\set client_side_copy_command '\\copy customer_copy_hash FROM ' :'customer3datafile' ' WITH (DELIMITER '''|''');'
:client_side_copy_command
-- Confirm that data was copied -- Confirm that data was copied
SELECT count(*) FROM customer_copy_hash; SELECT count(*) FROM customer_copy_hash;
@ -175,7 +184,7 @@ CREATE TABLE customer_copy_range (
SELECT master_create_distributed_table('customer_copy_range', 'c_custkey', 'range'); SELECT master_create_distributed_table('customer_copy_range', 'c_custkey', 'range');
-- Test COPY into empty range-partitioned table -- Test COPY into empty range-partitioned table
COPY customer_copy_range FROM '@abs_srcdir@/data/customer.1.data' WITH (DELIMITER '|'); COPY customer_copy_range FROM :'customer1datafile' WITH (DELIMITER '|');
SELECT master_create_empty_shard('customer_copy_range') AS new_shard_id SELECT master_create_empty_shard('customer_copy_range') AS new_shard_id
\gset \gset
@ -188,7 +197,7 @@ UPDATE pg_dist_shard SET shardminvalue = 501, shardmaxvalue = 1000
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
-- Test copy into range-partitioned table -- Test copy into range-partitioned table
COPY customer_copy_range FROM '@abs_srcdir@/data/customer.1.data' WITH (DELIMITER '|'); COPY customer_copy_range FROM :'customer1datafile' WITH (DELIMITER '|');
-- Check whether data went into the right shard (maybe) -- Check whether data went into the right shard (maybe)
SELECT min(c_custkey), max(c_custkey), avg(c_custkey), count(*) SELECT min(c_custkey), max(c_custkey), avg(c_custkey), count(*)
@ -284,14 +293,14 @@ SELECT create_distributed_table('lineitem_copy_append', 'l_orderkey', 'append');
BEGIN; BEGIN;
SELECT master_create_empty_shard('lineitem_copy_append') AS shardid \gset SELECT master_create_empty_shard('lineitem_copy_append') AS shardid \gset
COPY lineitem_copy_append FROM '@abs_srcdir@/data/lineitem.1.data' with (delimiter '|', append_to_shard :shardid); COPY lineitem_copy_append FROM :'lineitem1datafile' with (delimiter '|', append_to_shard :shardid);
END; END;
SELECT count(*) FROM pg_dist_shard WHERE logicalrelid = 'lineitem_copy_append'::regclass; SELECT count(*) FROM pg_dist_shard WHERE logicalrelid = 'lineitem_copy_append'::regclass;
-- trigger some errors on the append_to_shard option -- trigger some errors on the append_to_shard option
COPY lineitem_copy_append FROM '@abs_srcdir@/data/lineitem.1.data' with (delimiter '|', append_to_shard 1); COPY lineitem_copy_append FROM :'lineitem1datafile' with (delimiter '|', append_to_shard 1);
COPY lineitem_copy_append FROM '@abs_srcdir@/data/lineitem.1.data' with (delimiter '|', append_to_shard 560000); COPY lineitem_copy_append FROM :'lineitem1datafile' with (delimiter '|', append_to_shard 560000);
-- Test schema support on append partitioned tables -- Test schema support on append partitioned tables
CREATE SCHEMA append; CREATE SCHEMA append;
@ -310,8 +319,8 @@ SELECT master_create_empty_shard('append.customer_copy') AS shardid1 \gset
SELECT master_create_empty_shard('append.customer_copy') AS shardid2 \gset SELECT master_create_empty_shard('append.customer_copy') AS shardid2 \gset
-- Test copy from the master node -- Test copy from the master node
COPY append.customer_copy FROM '@abs_srcdir@/data/customer.1.data' with (delimiter '|', append_to_shard :shardid1); COPY append.customer_copy FROM :'customer1datafile' with (delimiter '|', append_to_shard :shardid1);
COPY append.customer_copy FROM '@abs_srcdir@/data/customer.2.data' with (delimiter '|', append_to_shard :shardid2); COPY append.customer_copy FROM :'customer2datafile' with (delimiter '|', append_to_shard :shardid2);
-- Test the content of the table -- Test the content of the table
SELECT min(c_custkey), max(c_custkey), avg(c_acctbal), count(*) FROM append.customer_copy; SELECT min(c_custkey), max(c_custkey), avg(c_acctbal), count(*) FROM append.customer_copy;

View File

@ -2,19 +2,27 @@
-- MULTI_LOAD_DATA -- MULTI_LOAD_DATA
-- --
\copy lineitem FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
COPY lineitem FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem FROM :'lineitem_2_data_file' with delimiter '|';
\copy orders FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\copy orders FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' \set orders_2_data_file :abs_srcdir '/data/orders.2.data'
COPY orders FROM :'orders_1_data_file' with delimiter '|';
COPY orders FROM :'orders_2_data_file' with delimiter '|';
\copy orders_reference FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' COPY orders_reference FROM :'orders_1_data_file' with delimiter '|';
\copy orders_reference FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' COPY orders_reference FROM :'orders_2_data_file' with delimiter '|';
\copy customer FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' \set customer_1_data_file :abs_srcdir '/data/customer.1.data'
\copy customer_append FROM '@abs_srcdir@/data/customer.1.data' with (delimiter '|', append_to_shard 360006) \set nation_data_file :abs_srcdir '/data/nation.data'
\copy nation FROM '@abs_srcdir@/data/nation.data' with delimiter '|' \set part_data_file :abs_srcdir '/data/part.data'
\copy part FROM '@abs_srcdir@/data/part.data' with delimiter '|' \set supplier_data_file :abs_srcdir '/data/supplier.data'
\copy part_append FROM '@abs_srcdir@/data/part.data' with (delimiter '|', append_to_shard 360009) COPY customer FROM :'customer_1_data_file' with delimiter '|';
\copy supplier FROM '@abs_srcdir@/data/supplier.data' with delimiter '|' COPY customer_append FROM :'customer_1_data_file' with (delimiter '|', append_to_shard 360006);
\copy supplier_single_shard FROM '@abs_srcdir@/data/supplier.data' with delimiter '|' COPY nation FROM :'nation_data_file' with delimiter '|';
COPY part FROM :'part_data_file' with delimiter '|';
COPY part_append FROM :'part_data_file' with (delimiter '|', append_to_shard 360009);
COPY supplier FROM :'supplier_data_file' with delimiter '|';
COPY supplier_single_shard FROM :'supplier_data_file' with delimiter '|';

View File

@ -1,4 +1,8 @@
\copy lineitem_hash_part FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem_hash_part FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
\copy orders_hash_part FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\copy orders_hash_part FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' \set orders_2_data_file :abs_srcdir '/data/orders.2.data'
COPY lineitem_hash_part FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem_hash_part FROM :'lineitem_2_data_file' with delimiter '|';
COPY orders_hash_part FROM :'orders_1_data_file' with delimiter '|';
COPY orders_hash_part FROM :'orders_2_data_file' with delimiter '|';

View File

@ -10,16 +10,19 @@ SET citus.next_shard_id TO 280000;
-- loading causes the planner to consider customer and part tables as large, and -- loading causes the planner to consider customer and part tables as large, and
-- evaluate plans where some of the underlying tables need to be repartitioned. -- evaluate plans where some of the underlying tables need to be repartitioned.
\copy customer FROM '@abs_srcdir@/data/customer.2.data' with delimiter '|' \set customer_2_data_file :abs_srcdir '/data/customer.2.data'
\copy customer FROM '@abs_srcdir@/data/customer.3.data' with delimiter '|' \set customer_3_data_file :abs_srcdir '/data/customer.3.data'
\copy part FROM '@abs_srcdir@/data/part.more.data' with delimiter '|' \set part_more_data_file :abs_srcdir '/data/part.more.data'
COPY customer FROM :'customer_2_data_file' with delimiter '|';
COPY customer FROM :'customer_3_data_file' with delimiter '|';
COPY part FROM :'part_more_data_file' with delimiter '|';
SELECT master_create_empty_shard('customer_append') AS shardid1 \gset SELECT master_create_empty_shard('customer_append') AS shardid1 \gset
SELECT master_create_empty_shard('customer_append') AS shardid2 \gset SELECT master_create_empty_shard('customer_append') AS shardid2 \gset
copy customer_append FROM '@abs_srcdir@/data/customer.2.data' with (delimiter '|', append_to_shard :shardid1); copy customer_append FROM :'customer_2_data_file' with (delimiter '|', append_to_shard :shardid1);
copy customer_append FROM '@abs_srcdir@/data/customer.3.data' with (delimiter '|', append_to_shard :shardid2); copy customer_append FROM :'customer_3_data_file' with (delimiter '|', append_to_shard :shardid2);
SELECT master_create_empty_shard('part_append') AS shardid \gset SELECT master_create_empty_shard('part_append') AS shardid \gset
copy part_append FROM '@abs_srcdir@/data/part.more.data' with (delimiter '|', append_to_shard :shardid); copy part_append FROM :'part_more_data_file' with (delimiter '|', append_to_shard :shardid);

View File

@ -11,28 +11,46 @@
SET citusdb.shard_placement_policy TO 'local-node-first'; SET citusdb.shard_placement_policy TO 'local-node-first';
-- load as superuser -- load as superuser
\copy lineitem FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\set copy_command '\\COPY lineitem FROM ' :'lineitem_1_data_file' ' with delimiter '''|''';'
:copy_command
-- as user with ALL access -- as user with ALL access
SET ROLE full_access; SET ROLE full_access;
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
\set copy_command '\\COPY lineitem FROM ' :'lineitem_2_data_file' ' with delimiter '''|''';'
:copy_command
RESET ROLE; RESET ROLE;
-- as user with SELECT access, should fail -- as user with SELECT access, should fail
SET ROLE read_access; SET ROLE read_access;
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set copy_command '\\COPY lineitem FROM ' :'lineitem_2_data_file' ' with delimiter '''|''';'
:copy_command
RESET ROLE; RESET ROLE;
-- as user with no access, should fail -- as user with no access, should fail
SET ROLE no_access; SET ROLE no_access;
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set copy_command '\\COPY lineitem FROM ' :'lineitem_2_data_file' ' with delimiter '''|''';'
:copy_command
RESET ROLE; RESET ROLE;
SET ROLE full_access; SET ROLE full_access;
\copy orders FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\copy orders FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' \set orders_2_data_file :abs_srcdir '/data/orders.2.data'
\set copy_command '\\COPY orders FROM ' :'orders_1_data_file' ' with delimiter '''|''';'
:copy_command
\set copy_command '\\COPY orders FROM ' :'orders_2_data_file' ' with delimiter '''|''';'
:copy_command
\copy customer FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' \set customer_1_data_file :abs_srcdir '/data/customer.1.data'
\copy nation FROM '@abs_srcdir@/data/nation.data' with delimiter '|' \set nation_data_file :abs_srcdir '/data/nation.data'
\copy part FROM '@abs_srcdir@/data/part.data' with delimiter '|' \set part_data_file :abs_srcdir '/data/part.data'
\copy supplier FROM '@abs_srcdir@/data/supplier.data' with delimiter '|' \set supplier_data_file :abs_srcdir '/data/supplier.data'
\set copy_command '\\COPY customer FROM ' :'customer_1_data_file' ' with delimiter '''|''';'
:copy_command
\set copy_command '\\COPY nation FROM ' :'nation_data_file' ' with delimiter '''|''';'
:copy_command
\set copy_command '\\COPY part FROM ' :'part_data_file' ' with delimiter '''|''';'
:copy_command
\set copy_command '\\COPY supplier FROM ' :'supplier_data_file' ' with delimiter '''|''';'
:copy_command

View File

@ -2,33 +2,40 @@
-- MULTI_MX_COPY_DATA -- MULTI_MX_COPY_DATA
-- --
\COPY nation_hash FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; \set nation_data_file :abs_srcdir '/data/nation.data'
COPY nation_hash FROM :'nation_data_file' with delimiter '|';
SET search_path TO citus_mx_test_schema; SET search_path TO citus_mx_test_schema;
\COPY nation_hash FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY nation_hash FROM :'nation_data_file' with delimiter '|';
\COPY citus_mx_test_schema_join_1.nation_hash FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY citus_mx_test_schema_join_1.nation_hash FROM :'nation_data_file' with delimiter '|';
\COPY citus_mx_test_schema_join_1.nation_hash_2 FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY citus_mx_test_schema_join_1.nation_hash_2 FROM :'nation_data_file' with delimiter '|';
\COPY citus_mx_test_schema_join_2.nation_hash FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY citus_mx_test_schema_join_2.nation_hash FROM :'nation_data_file' with delimiter '|';
SET citus.shard_replication_factor TO 2; SET citus.shard_replication_factor TO 2;
CREATE TABLE citus_mx_test_schema.nation_hash_replicated AS SELECT * FROM citus_mx_test_schema.nation_hash; CREATE TABLE citus_mx_test_schema.nation_hash_replicated AS SELECT * FROM citus_mx_test_schema.nation_hash;
SELECT create_distributed_table('citus_mx_test_schema.nation_hash_replicated', 'n_nationkey'); SELECT create_distributed_table('citus_mx_test_schema.nation_hash_replicated', 'n_nationkey');
\COPY nation_hash_replicated FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY nation_hash_replicated FROM :'nation_data_file' with delimiter '|';
-- now try loading data from worker node -- now try loading data from worker node
\c - - - :worker_1_port \c - - - :worker_1_port
SET search_path TO public; SET search_path TO public;
\COPY lineitem_mx FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\COPY lineitem_mx FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
COPY lineitem_mx FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem_mx FROM :'lineitem_2_data_file' with delimiter '|';
\COPY citus_mx_test_schema.nation_hash_replicated FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; \set nation_data_file :abs_srcdir '/data/nation.data'
COPY citus_mx_test_schema.nation_hash_replicated FROM :'nation_data_file' with delimiter '|';
\c - - - :worker_2_port \c - - - :worker_2_port
-- and use second worker as well -- and use second worker as well
\COPY orders_mx FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\COPY orders_mx FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' \set orders_2_data_file :abs_srcdir '/data/orders.2.data'
\COPY citus_mx_test_schema.nation_hash_replicated FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; \set nation_data_file :abs_srcdir '/data/nation.data'
COPY orders_mx FROM :'orders_1_data_file' with delimiter '|';
COPY orders_mx FROM :'orders_2_data_file' with delimiter '|';
COPY citus_mx_test_schema.nation_hash_replicated FROM :'nation_data_file' with delimiter '|';
-- get ready for the next test -- get ready for the next test
TRUNCATE orders_mx; TRUNCATE orders_mx;
@ -40,10 +47,14 @@ ALTER SYSTEM SET citus.local_shared_pool_size TO -1;
SELECT pg_reload_conf(); SELECT pg_reload_conf();
SELECT pg_sleep(0.1); SELECT pg_sleep(0.1);
show citus.local_shared_pool_size; show citus.local_shared_pool_size;
\COPY orders_mx FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|'
\COPY orders_mx FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|'
\COPY citus_mx_test_schema.nation_hash_replicated FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\set orders_2_data_file :abs_srcdir '/data/orders.2.data'
COPY orders_mx FROM :'orders_1_data_file' with delimiter '|';
COPY orders_mx FROM :'orders_2_data_file' with delimiter '|';
\set nation_data_file :abs_srcdir '/data/nation.data'
COPY citus_mx_test_schema.nation_hash_replicated FROM :'nation_data_file' with delimiter '|';
-- set it back -- set it back
ALTER SYSTEM RESET citus.local_shared_pool_size; ALTER SYSTEM RESET citus.local_shared_pool_size;
@ -58,7 +69,11 @@ show citus.local_shared_pool_size;
\c - - - :master_port \c - - - :master_port
SET search_path TO public; SET search_path TO public;
\COPY customer_mx FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' \set customer_1_data_file :abs_srcdir '/data/customer.1.data'
\COPY nation_mx FROM '@abs_srcdir@/data/nation.data' with delimiter '|' \set nation_data_file :abs_srcdir '/data/nation.data'
\COPY part_mx FROM '@abs_srcdir@/data/part.data' with delimiter '|' \set part_data_file :abs_srcdir '/data/part.data'
\COPY supplier_mx FROM '@abs_srcdir@/data/supplier.data' with delimiter '|' \set supplier_data_file :abs_srcdir '/data/supplier.data'
COPY customer_mx FROM :'customer_1_data_file' with delimiter '|';
COPY nation_mx FROM :'nation_data_file' with delimiter '|';
COPY part_mx FROM :'part_data_file' with delimiter '|';
COPY supplier_mx FROM :'supplier_data_file' with delimiter '|';

View File

@ -69,11 +69,13 @@ CREATE TABLE multi_outer_join_third_reference
t_comment varchar(117) not null t_comment varchar(117) not null
); );
SELECT create_reference_table('multi_outer_join_third_reference'); SELECT create_reference_table('multi_outer_join_third_reference');
\set customer_1_10_data :abs_srcdir '/data/customer-1-10.data'
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-1-10.data' with delimiter '|' \set customer_11_20_data :abs_srcdir '/data/customer-11-20.data'
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' \set customer_1_15_data :abs_srcdir '/data/customer-1-15.data'
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' COPY multi_outer_join_left FROM :'customer_1_10_data' with delimiter '|';
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' COPY multi_outer_join_left FROM :'customer_11_20_data' with delimiter '|';
COPY multi_outer_join_right FROM :'customer_1_15_data' with delimiter '|';
COPY multi_outer_join_right_reference FROM :'customer_1_15_data' with delimiter '|';
-- Make sure we do not crash if one table has no shards -- Make sure we do not crash if one table has no shards
SELECT SELECT
@ -87,8 +89,9 @@ FROM
multi_outer_join_third a LEFT JOIN multi_outer_join_right_reference b ON (r_custkey = t_custkey); multi_outer_join_third a LEFT JOIN multi_outer_join_right_reference b ON (r_custkey = t_custkey);
-- Third table is a single shard table with all data -- Third table is a single shard table with all data
\copy multi_outer_join_third FROM '@abs_srcdir@/data/customer-1-30.data' with delimiter '|' \set customer_1_30_data :abs_srcdir '/data/customer-1-30.data'
\copy multi_outer_join_third_reference FROM '@abs_srcdir@/data/customer-1-30.data' with delimiter '|' COPY multi_outer_join_third FROM :'customer_1_30_data' with delimiter '|';
COPY multi_outer_join_third_reference FROM :'customer_1_30_data' with delimiter '|';
-- Regular outer join should return results for all rows -- Regular outer join should return results for all rows
SELECT SELECT
@ -167,7 +170,8 @@ FROM
-- Turn the right table into a large table -- Turn the right table into a large table
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' \set customer_21_30_data :abs_srcdir '/data/customer-21-30.data'
COPY multi_outer_join_right FROM :'customer_21_30_data' with delimiter '|';
-- Shards do not have 1-1 matching. We should error here. -- Shards do not have 1-1 matching. We should error here.
@ -181,11 +185,13 @@ TRUNCATE multi_outer_join_left;
TRUNCATE multi_outer_join_right; TRUNCATE multi_outer_join_right;
-- reload shards with 1-1 matching -- reload shards with 1-1 matching
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-subset-11-20.data' with delimiter '|' \set customer_subset_11_20_data :abs_srcdir '/data/customer-subset-11-20.data'
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' COPY multi_outer_join_left FROM :'customer_subset_11_20_data' with delimiter '|';
COPY multi_outer_join_left FROM :'customer_21_30_data' with delimiter '|';
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' \set customer_subset_21_30_data :abs_srcdir '/data/customer-subset-21-30.data'
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-subset-21-30.data' with delimiter '|' COPY multi_outer_join_right FROM :'customer_11_20_data' with delimiter '|';
COPY multi_outer_join_right FROM :'customer_subset_21_30_data' with delimiter '|';
-- multi_outer_join_third is a single shard table -- multi_outer_join_third is a single shard table
-- Regular left join should work as expected -- Regular left join should work as expected
@ -447,7 +453,8 @@ ORDER BY cnt DESC, l1.l_custkey DESC
LIMIT 20; LIMIT 20;
-- Add a shard to the left table that overlaps with multiple shards in the right -- Add a shard to the left table that overlaps with multiple shards in the right
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' \set customer_1_data_file :abs_srcdir '/data/customer.1.data'
COPY multi_outer_join_left FROM :'customer_1_data_file' with delimiter '|';
-- All outer joins should error out -- All outer joins should error out
@ -483,7 +490,7 @@ SET citus.shard_replication_factor to 1;
SELECT create_distributed_table('left_values', 'val'); SELECT create_distributed_table('left_values', 'val');
\copy left_values from stdin COPY left_values from stdin;
1 1
2 2
3 3
@ -495,7 +502,7 @@ CREATE TABLE right_values(val int);
SELECT create_distributed_table('right_values', 'val'); SELECT create_distributed_table('right_values', 'val');
\copy right_values from stdin COPY right_values from stdin;
2 2
3 3
4 4

View File

@ -64,12 +64,15 @@ FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_third_reference b ON (l_custkey = t_custkey); multi_outer_join_left_hash a LEFT JOIN multi_outer_join_third_reference b ON (l_custkey = t_custkey);
-- Left table is a large table -- Left table is a large table
\copy multi_outer_join_left_hash FROM '@abs_srcdir@/data/customer-1-10.data' with delimiter '|' \set customer_1_10_data :abs_srcdir '/data/customer-1-10.data'
\copy multi_outer_join_left_hash FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' \set customer_11_20_data :abs_srcdir '/data/customer-11-20.data'
COPY multi_outer_join_left_hash FROM :'customer_1_10_data' with delimiter '|';
COPY multi_outer_join_left_hash FROM :'customer_11_20_data' with delimiter '|';
-- Right table is a small table -- Right table is a small table
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' \set customer_1_15_data :abs_srcdir '/data/customer-1-15.data'
\copy multi_outer_join_right_hash FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' COPY multi_outer_join_right_reference FROM :'customer_1_15_data' with delimiter '|';
COPY multi_outer_join_right_hash FROM :'customer_1_15_data' with delimiter '|';
-- Make sure we do not crash if one table has data -- Make sure we do not crash if one table has data
SELECT SELECT
@ -83,8 +86,9 @@ FROM
multi_outer_join_third_reference a LEFT JOIN multi_outer_join_right_reference b ON (r_custkey = t_custkey); multi_outer_join_third_reference a LEFT JOIN multi_outer_join_right_reference b ON (r_custkey = t_custkey);
-- Third table is a single shard table with all data -- Third table is a single shard table with all data
\copy multi_outer_join_third_reference FROM '@abs_srcdir@/data/customer-1-30.data' with delimiter '|' \set customer_1_30_data :abs_srcdir '/data/customer-1-30.data'
\copy multi_outer_join_right_hash FROM '@abs_srcdir@/data/customer-1-30.data' with delimiter '|' COPY multi_outer_join_third_reference FROM :'customer_1_30_data' with delimiter '|';
COPY multi_outer_join_right_hash FROM :'customer_1_30_data' with delimiter '|';
-- Regular outer join should return results for all rows -- Regular outer join should return results for all rows
@ -164,7 +168,8 @@ FROM
-- load some more data -- load some more data
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' \set customer_21_30_data :abs_srcdir '/data/customer-21-30.data'
COPY multi_outer_join_right_reference FROM :'customer_21_30_data' with delimiter '|';
-- Update shards so that they do not have 1-1 matching, triggering an error. -- Update shards so that they do not have 1-1 matching, triggering an error.
UPDATE pg_dist_shard SET shardminvalue = '2147483646' WHERE shardid = 1260006; UPDATE pg_dist_shard SET shardminvalue = '2147483646' WHERE shardid = 1260006;
@ -180,14 +185,14 @@ UPDATE pg_dist_shard SET shardmaxvalue = '-1073741825' WHERE shardid = 1260006;
TRUNCATE multi_outer_join_left_hash, multi_outer_join_right_hash, multi_outer_join_right_reference; TRUNCATE multi_outer_join_left_hash, multi_outer_join_right_hash, multi_outer_join_right_reference;
-- reload shards with 1-1 matching -- reload shards with 1-1 matching
\copy multi_outer_join_left_hash FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' COPY multi_outer_join_left_hash FROM :'customer_1_15_data' with delimiter '|';
\copy multi_outer_join_left_hash FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' COPY multi_outer_join_left_hash FROM :'customer_21_30_data' with delimiter '|';
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' COPY multi_outer_join_right_reference FROM :'customer_11_20_data' with delimiter '|';
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' COPY multi_outer_join_right_reference FROM :'customer_21_30_data' with delimiter '|';
\copy multi_outer_join_right_hash FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' COPY multi_outer_join_right_hash FROM :'customer_11_20_data' with delimiter '|';
\copy multi_outer_join_right_hash FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' COPY multi_outer_join_right_hash FROM :'customer_21_30_data' with delimiter '|';
-- multi_outer_join_third_reference is a single shard table -- multi_outer_join_third_reference is a single shard table

View File

@ -1,5 +1,8 @@
CREATE TABLESPACE test_tablespace LOCATION '@abs_srcdir@/tmp_check/ts0'; \set test_tablespace :abs_srcdir '/tmp_check/ts0'
CREATE TABLESPACE test_tablespace LOCATION :'test_tablespace';
\c - - - :worker_1_port \c - - - :worker_1_port
CREATE TABLESPACE test_tablespace LOCATION '@abs_srcdir@/tmp_check/ts1'; \set test_tablespace :abs_srcdir '/tmp_check/ts1'
CREATE TABLESPACE test_tablespace LOCATION :'test_tablespace';
\c - - - :worker_2_port \c - - - :worker_2_port
CREATE TABLESPACE test_tablespace LOCATION '@abs_srcdir@/tmp_check/ts2'; \set test_tablespace :abs_srcdir '/tmp_check/ts2'
CREATE TABLESPACE test_tablespace LOCATION :'test_tablespace';

View File

@ -5,7 +5,8 @@ CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
percentile FLOAT, country CHAR(3), achievements TEXT[]) percentile FLOAT, country CHAR(3), achievements TEXT[])
USING columnar; USING columnar;
-- load table data from file -- load table data from file
COPY test_contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV; \set contestants_1_csv_file :abs_srcdir '/data/contestants.1.csv'
COPY test_contestant FROM :'contestants_1_csv_file' WITH CSV;
-- export using COPY table TO ... -- export using COPY table TO ...
COPY test_contestant TO STDOUT; COPY test_contestant TO STDOUT;
a 01-10-1990 2090 97.1 XA {a} a 01-10-1990 2090 97.1 XA {a}

View File

@ -8,10 +8,11 @@ SET intervalstyle TO 'POSTGRES_VERBOSE';
-- Test array types -- Test array types
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[], CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
text_array text[]) USING columnar; text_array text[]) USING columnar;
COPY test_array_types FROM '@abs_srcdir@/data/array_types.csv' WITH CSV; \set array_types_csv_file :abs_srcdir '/data/array_types.csv'
COPY test_array_types FROM :'array_types_csv_file' WITH CSV;
SELECT * FROM test_array_types; SELECT * FROM test_array_types;
int_array | bigint_array | text_array int_array | bigint_array | text_array
--------------------------+--------------------------------------------+------------ ---------------------------------------------------------------------
{1,2,3} | {1,2,3} | {a,b,c} {1,2,3} | {1,2,3} | {a,b,c}
{} | {} | {} {} | {} | {}
{-2147483648,2147483647} | {-9223372036854775808,9223372036854775807} | {""} {-2147483648,2147483647} | {-9223372036854775808,9223372036854775807} | {""}
@ -21,10 +22,11 @@ SELECT * FROM test_array_types;
CREATE TABLE test_datetime_types (timestamp timestamp, CREATE TABLE test_datetime_types (timestamp timestamp,
timestamp_with_timezone timestamp with time zone, date date, time time, timestamp_with_timezone timestamp with time zone, date date, time time,
interval interval) USING columnar; interval interval) USING columnar;
COPY test_datetime_types FROM '@abs_srcdir@/data/datetime_types.csv' WITH CSV; \set datetime_types_csv_file :abs_srcdir '/data/datetime_types.csv'
COPY test_datetime_types FROM :'datetime_types_csv_file' WITH CSV;
SELECT * FROM test_datetime_types; SELECT * FROM test_datetime_types;
timestamp | timestamp_with_timezone | date | time | interval timestamp | timestamp_with_timezone | date | time | interval
---------------------+-------------------------+------------+----------+----------- ---------------------------------------------------------------------
2000-01-02 04:05:06 | 1999-01-08 12:05:06+00 | 2000-01-02 | 04:05:06 | @ 4 hours 2000-01-02 04:05:06 | 1999-01-08 12:05:06+00 | 2000-01-02 | 04:05:06 | @ 4 hours
1970-01-01 00:00:00 | infinity | -infinity | 00:00:00 | @ 0 1970-01-01 00:00:00 | infinity | -infinity | 00:00:00 | @ 0
(2 rows) (2 rows)
@ -34,11 +36,12 @@ CREATE TYPE enum_type AS ENUM ('a', 'b', 'c');
CREATE TYPE composite_type AS (a int, b text); CREATE TYPE composite_type AS (a int, b text);
CREATE TABLE test_enum_and_composite_types (enum enum_type, CREATE TABLE test_enum_and_composite_types (enum enum_type,
composite composite_type) USING columnar; composite composite_type) USING columnar;
\set enum_and_composite_types_csv_file :abs_srcdir '/data/enum_and_composite_types.csv'
COPY test_enum_and_composite_types FROM COPY test_enum_and_composite_types FROM
'@abs_srcdir@/data/enum_and_composite_types.csv' WITH CSV; :'enum_and_composite_types_csv_file' WITH CSV;
SELECT * FROM test_enum_and_composite_types; SELECT * FROM test_enum_and_composite_types;
enum | composite enum | composite
------+----------- ---------------------------------------------------------------------
a | (2,b) a | (2,b)
b | (3,c) b | (3,c)
(2 rows) (2 rows)
@ -46,10 +49,11 @@ SELECT * FROM test_enum_and_composite_types;
-- Test range types -- Test range types
CREATE TABLE test_range_types (int4range int4range, int8range int8range, CREATE TABLE test_range_types (int4range int4range, int8range int8range,
numrange numrange, tsrange tsrange) USING columnar; numrange numrange, tsrange tsrange) USING columnar;
COPY test_range_types FROM '@abs_srcdir@/data/range_types.csv' WITH CSV; \set range_types_csv_file :abs_srcdir '/data/range_types.csv'
COPY test_range_types FROM :'range_types_csv_file' WITH CSV;
SELECT * FROM test_range_types; SELECT * FROM test_range_types;
int4range | int8range | numrange | tsrange int4range | int8range | numrange | tsrange
-----------+-----------+----------+----------------------------------------------- ---------------------------------------------------------------------
[1,3) | [1,3) | [1,3) | ["2000-01-02 00:30:00","2010-02-03 12:30:00") [1,3) | [1,3) | [1,3) | ["2000-01-02 00:30:00","2010-02-03 12:30:00")
empty | [1,) | (,) | empty empty | [1,) | (,) | empty
(2 rows) (2 rows)
@ -57,10 +61,11 @@ SELECT * FROM test_range_types;
-- Test other types -- Test other types
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money, CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
inet inet, bitstring bit varying(5), uuid uuid, json json) USING columnar; inet inet, bitstring bit varying(5), uuid uuid, json json) USING columnar;
COPY test_other_types FROM '@abs_srcdir@/data/other_types.csv' WITH CSV; \set other_types_csv_file :abs_srcdir '/data/other_types.csv'
COPY test_other_types FROM :'other_types_csv_file' WITH CSV;
SELECT * FROM test_other_types; SELECT * FROM test_other_types;
bool | bytea | money | inet | bitstring | uuid | json bool | bytea | money | inet | bitstring | uuid | json
------+------------+-------+-------------+-----------+--------------------------------------+------------------ ---------------------------------------------------------------------
f | \xdeadbeef | $1.00 | 192.168.1.2 | 10101 | a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 | {"key": "value"} f | \xdeadbeef | $1.00 | 192.168.1.2 | 10101 | a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 | {"key": "value"}
t | \xcdb0 | $1.50 | 127.0.0.1 | | a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 | [] t | \xcdb0 | $1.50 | 127.0.0.1 | | a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11 | []
(2 rows) (2 rows)
@ -68,10 +73,11 @@ SELECT * FROM test_other_types;
-- Test null values -- Test null values
CREATE TABLE test_null_values (a int, b int[], c composite_type) CREATE TABLE test_null_values (a int, b int[], c composite_type)
USING columnar; USING columnar;
COPY test_null_values FROM '@abs_srcdir@/data/null_values.csv' WITH CSV; \set null_values_csv_file :abs_srcdir '/data/null_values.csv'
COPY test_null_values FROM :'null_values_csv_file' WITH CSV;
SELECT * FROM test_null_values; SELECT * FROM test_null_values;
a | b | c a | b | c
---+--------+----- ---------------------------------------------------------------------
| {NULL} | (,) | {NULL} | (,)
| | | |
(2 rows) (2 rows)

View File

@ -2,7 +2,8 @@
-- Test loading data into columnar tables. -- Test loading data into columnar tables.
-- --
-- COPY with incorrect delimiter -- COPY with incorrect delimiter
COPY contestant FROM '@abs_srcdir@/data/contestants.1.csv' \set contestants_1_csv_file :abs_srcdir '/data/contestants.1.csv'
COPY contestant FROM :'contestants_1_csv_file'
WITH DELIMITER '|'; -- ERROR WITH DELIMITER '|'; -- ERROR
ERROR: missing data for column "birthdate" ERROR: missing data for column "birthdate"
CONTEXT: COPY contestant, line 1: "a,1990-01-10,2090,97.1,XA ,{a}" CONTEXT: COPY contestant, line 1: "a,1990-01-10,2090,97.1,XA ,{a}"
@ -11,9 +12,10 @@ COPY contestant FROM PROGRAM 'invalid_program' WITH CSV; -- ERROR
ERROR: program "invalid_program" failed ERROR: program "invalid_program" failed
DETAIL: command not found DETAIL: command not found
-- COPY into uncompressed table from file -- COPY into uncompressed table from file
COPY contestant FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV; COPY contestant FROM :'contestants_1_csv_file' WITH CSV;
-- COPY into uncompressed table from program -- COPY into uncompressed table from program
COPY contestant FROM PROGRAM 'cat @abs_srcdir@/data/contestants.2.csv' WITH CSV; \set cat_contestants_2_csv_file 'cat ' :abs_srcdir '/data/contestants.2.csv'
COPY contestant FROM PROGRAM :'cat_contestants_2_csv_file' WITH CSV;
select select
version_major, version_minor, reserved_stripe_id, reserved_row_number version_major, version_minor, reserved_stripe_id, reserved_row_number
from columnar_test_helpers.columnar_storage_info('contestant'); from columnar_test_helpers.columnar_storage_info('contestant');
@ -23,9 +25,9 @@ select
(1 row) (1 row)
-- COPY into compressed table -- COPY into compressed table
COPY contestant_compressed FROM '@abs_srcdir@/data/contestants.1.csv' WITH CSV; COPY contestant_compressed FROM :'contestants_1_csv_file' WITH CSV;
-- COPY into uncompressed table from program -- COPY into uncompressed table from program
COPY contestant_compressed FROM PROGRAM 'cat @abs_srcdir@/data/contestants.2.csv' COPY contestant_compressed FROM PROGRAM :'cat_contestants_2_csv_file'
WITH CSV; WITH CSV;
select select
version_major, version_minor, reserved_stripe_id, reserved_row_number version_major, version_minor, reserved_stripe_id, reserved_row_number
@ -42,7 +44,7 @@ COPY famous_constants (value, name, id) FROM STDIN WITH CSV;
COPY famous_constants (name, value) FROM STDIN WITH CSV; COPY famous_constants (name, value) FROM STDIN WITH CSV;
SELECT * FROM famous_constants ORDER BY id, name; SELECT * FROM famous_constants ORDER BY id, name;
id | name | value id | name | value
----+----------------+----------- ---------------------------------------------------------------------
1 | pi | 3.141 1 | pi | 3.141
2 | e | 2.718 2 | e | 2.718
3 | gamma | 0.577 3 | gamma | 0.577

View File

@ -63,52 +63,57 @@ CREATE TABLE impressions (
begin; begin;
SELECT create_distributed_table('companies', 'id'); SELECT create_distributed_table('companies', 'id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
SELECT create_distributed_table('campaigns', 'company_id'); SELECT create_distributed_table('campaigns', 'company_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
rollback; rollback;
SELECT create_distributed_table('companies', 'id'); SELECT create_distributed_table('companies', 'id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
SELECT create_distributed_table('campaigns', 'company_id'); SELECT create_distributed_table('campaigns', 'company_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
SELECT create_distributed_table('ads', 'company_id'); SELECT create_distributed_table('ads', 'company_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
SELECT create_distributed_table('clicks', 'company_id'); SELECT create_distributed_table('clicks', 'company_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
SELECT create_distributed_table('impressions', 'company_id'); SELECT create_distributed_table('impressions', 'company_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
\copy companies from '@abs_srcdir@/data/companies.csv' with csv \set companies_csv_file :abs_srcdir '/data/companies.csv'
\copy campaigns from '@abs_srcdir@/data/campaigns.csv' with csv \set campaigns_csv_file :abs_srcdir '/data/campaigns.csv'
\copy ads from '@abs_srcdir@/data/ads.csv' with csv \set ads_csv_file :abs_srcdir '/data/ads.csv'
\copy clicks from '@abs_srcdir@/data/clicks.csv' with csv \set clicks_csv_file :abs_srcdir '/data/clicks.csv'
\copy impressions from '@abs_srcdir@/data/impressions.csv' with csv \set impressions_csv_file :abs_srcdir '/data/impressions.csv'
COPY companies from :'companies_csv_file' with csv;
COPY campaigns from :'campaigns_csv_file' with csv;
COPY ads from :'ads_csv_file' with csv;
COPY clicks from :'clicks_csv_file' with csv;
COPY impressions from :'impressions_csv_file' with csv;
SELECT a.campaign_id, SELECT a.campaign_id,
RANK() OVER ( RANK() OVER (
PARTITION BY a.campaign_id PARTITION BY a.campaign_id
@ -123,7 +128,7 @@ GROUP BY a.campaign_id, a.id
ORDER BY a.campaign_id, n_impressions desc, a.id ORDER BY a.campaign_id, n_impressions desc, a.id
LIMIT 10; LIMIT 10;
campaign_id | rank | n_impressions | id campaign_id | rank | n_impressions | id
-------------+------+---------------+----- ---------------------------------------------------------------------
34 | 1 | 68 | 264 34 | 1 | 68 | 264
34 | 2 | 56 | 266 34 | 2 | 56 | 266
34 | 3 | 41 | 267 34 | 3 | 41 | 267
@ -198,18 +203,18 @@ CREATE TABLE impressions (
FOREIGN KEY (company_id, ad_id) FOREIGN KEY (company_id, ad_id)
REFERENCES ads (company_id, id) REFERENCES ads (company_id, id)
); );
\copy companies from '@abs_srcdir@/data/companies.csv' with csv COPY companies from :'companies_csv_file' with csv;
\copy campaigns from '@abs_srcdir@/data/campaigns.csv' with csv COPY campaigns from :'campaigns_csv_file' with csv;
\copy ads from '@abs_srcdir@/data/ads.csv' with csv COPY ads from :'ads_csv_file' with csv;
\copy clicks from '@abs_srcdir@/data/clicks.csv' with csv COPY clicks from :'clicks_csv_file' with csv;
\copy impressions from '@abs_srcdir@/data/impressions.csv' with csv COPY impressions from :'impressions_csv_file' with csv;
SELECT create_distributed_table('companies', 'id'); SELECT create_distributed_table('companies', 'id');
NOTICE: Copying data from local table... NOTICE: Copying data from local table...
NOTICE: copying the data has completed NOTICE: copying the data has completed
DETAIL: The local data in the table is no longer visible, but is still on disk. DETAIL: The local data in the table is no longer visible, but is still on disk.
HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.companies$$) HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.companies$$)
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -219,7 +224,7 @@ NOTICE: copying the data has completed
DETAIL: The local data in the table is no longer visible, but is still on disk. DETAIL: The local data in the table is no longer visible, but is still on disk.
HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.campaigns$$) HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.campaigns$$)
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -229,7 +234,7 @@ NOTICE: copying the data has completed
DETAIL: The local data in the table is no longer visible, but is still on disk. DETAIL: The local data in the table is no longer visible, but is still on disk.
HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.ads$$) HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.ads$$)
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -239,7 +244,7 @@ NOTICE: copying the data has completed
DETAIL: The local data in the table is no longer visible, but is still on disk. DETAIL: The local data in the table is no longer visible, but is still on disk.
HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.clicks$$) HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.clicks$$)
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -249,7 +254,7 @@ NOTICE: copying the data has completed
DETAIL: The local data in the table is no longer visible, but is still on disk. DETAIL: The local data in the table is no longer visible, but is still on disk.
HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.impressions$$) HINT: To remove the local data, run: SELECT truncate_local_data_after_distributing_table($$public.impressions$$)
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -267,7 +272,7 @@ GROUP BY a.campaign_id, a.id
ORDER BY a.campaign_id, n_impressions desc, a.id ORDER BY a.campaign_id, n_impressions desc, a.id
LIMIT 10; LIMIT 10;
campaign_id | rank | n_impressions | id campaign_id | rank | n_impressions | id
-------------+------+---------------+----- ---------------------------------------------------------------------
59 | 1 | 70 | 477 59 | 1 | 70 | 477
59 | 2 | 69 | 479 59 | 2 | 69 | 479
59 | 3 | 63 | 475 59 | 3 | 63 | 475

View File

@ -22,7 +22,7 @@ CREATE TABLE lineitem_range (
l_comment varchar(44) not null ); l_comment varchar(44) not null );
SELECT create_distributed_table('lineitem_range', 'l_orderkey', 'range'); SELECT create_distributed_table('lineitem_range', 'l_orderkey', 'range');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -34,18 +34,20 @@ SELECT master_create_empty_shard('lineitem_range') AS new_shard_id
\gset \gset
UPDATE pg_dist_shard SET shardminvalue = 8997, shardmaxvalue = 14947 UPDATE pg_dist_shard SET shardminvalue = 8997, shardmaxvalue = 14947
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
\copy lineitem_range FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem_range FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
COPY lineitem_range FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem_range FROM :'lineitem_2_data_file' with delimiter '|';
-- Run aggregate(distinct) on partition column for range partitioned table -- Run aggregate(distinct) on partition column for range partitioned table
SELECT count(distinct l_orderkey) FROM lineitem_range; SELECT count(distinct l_orderkey) FROM lineitem_range;
count count
------- ---------------------------------------------------------------------
2985 2985
(1 row) (1 row)
SELECT avg(distinct l_orderkey) FROM lineitem_range; SELECT avg(distinct l_orderkey) FROM lineitem_range;
avg avg
----------------------- ---------------------------------------------------------------------
7463.9474036850921273 7463.9474036850921273
(1 row) (1 row)
@ -57,7 +59,7 @@ SELECT p_partkey, count(distinct l_orderkey) FROM lineitem_range, part
GROUP BY p_partkey GROUP BY p_partkey
ORDER BY p_partkey LIMIT 10; ORDER BY p_partkey LIMIT 10;
p_partkey | count p_partkey | count
-----------+------- ---------------------------------------------------------------------
18 | 1 18 | 1
79 | 1 79 | 1
91 | 1 91 | 1
@ -73,38 +75,38 @@ SELECT p_partkey, count(distinct l_orderkey) FROM lineitem_range, part
-- Check that we support more complex expressions. -- Check that we support more complex expressions.
SELECT count(distinct (l_orderkey)) FROM lineitem_range; SELECT count(distinct (l_orderkey)) FROM lineitem_range;
count count
------- ---------------------------------------------------------------------
2985 2985
(1 row) (1 row)
SELECT count(distinct (l_orderkey + 1)) FROM lineitem_range; SELECT count(distinct (l_orderkey + 1)) FROM lineitem_range;
count count
------- ---------------------------------------------------------------------
2985 2985
(1 row) (1 row)
SELECT count(distinct (l_orderkey % 5)) FROM lineitem_range; SELECT count(distinct (l_orderkey % 5)) FROM lineitem_range;
count count
------- ---------------------------------------------------------------------
5 5
(1 row) (1 row)
-- count(distinct) on non-partition column is allowed -- count(distinct) on non-partition column is allowed
SELECT count(distinct l_partkey) FROM lineitem_range; SELECT count(distinct l_partkey) FROM lineitem_range;
count count
------- ---------------------------------------------------------------------
11661 11661
(1 row) (1 row)
SELECT count(distinct (l_partkey + 1)) FROM lineitem_range; SELECT count(distinct (l_partkey + 1)) FROM lineitem_range;
count count
------- ---------------------------------------------------------------------
11661 11661
(1 row) (1 row)
SELECT count(distinct (l_partkey % 5)) FROM lineitem_range; SELECT count(distinct (l_partkey % 5)) FROM lineitem_range;
count count
------- ---------------------------------------------------------------------
5 5
(1 row) (1 row)
@ -112,13 +114,13 @@ SELECT count(distinct (l_partkey % 5)) FROM lineitem_range;
-- sharded table. -- sharded table.
SELECT count(distinct p_mfgr) FROM part; SELECT count(distinct p_mfgr) FROM part;
count count
------- ---------------------------------------------------------------------
5 5
(1 row) (1 row)
SELECT p_mfgr, count(distinct p_partkey) FROM part GROUP BY p_mfgr ORDER BY p_mfgr; SELECT p_mfgr, count(distinct p_partkey) FROM part GROUP BY p_mfgr ORDER BY p_mfgr;
p_mfgr | count p_mfgr | count
---------------------------+------- ---------------------------------------------------------------------
Manufacturer#1 | 193 Manufacturer#1 | 193
Manufacturer#2 | 190 Manufacturer#2 | 190
Manufacturer#3 | 228 Manufacturer#3 | 228
@ -130,7 +132,7 @@ SELECT p_mfgr, count(distinct p_partkey) FROM part GROUP BY p_mfgr ORDER BY p_mf
-- both on partition column, and non-partition column. -- both on partition column, and non-partition column.
SELECT count(distinct o_orderkey), count(distinct o_custkey) FROM orders; SELECT count(distinct o_orderkey), count(distinct o_custkey) FROM orders;
count | count count | count
-------+------- ---------------------------------------------------------------------
2985 | 923 2985 | 923
(1 row) (1 row)
@ -155,60 +157,60 @@ CREATE TABLE lineitem_hash (
SET citus.shard_replication_factor TO 1; SET citus.shard_replication_factor TO 1;
SELECT create_distributed_table('lineitem_hash', 'l_orderkey', 'hash'); SELECT create_distributed_table('lineitem_hash', 'l_orderkey', 'hash');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
\copy lineitem_hash FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' COPY lineitem_hash FROM :'lineitem_1_data_file' with delimiter '|';
\copy lineitem_hash FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' COPY lineitem_hash FROM :'lineitem_2_data_file' with delimiter '|';
-- aggregate(distinct) on partition column is allowed -- aggregate(distinct) on partition column is allowed
SELECT count(distinct l_orderkey) FROM lineitem_hash; SELECT count(distinct l_orderkey) FROM lineitem_hash;
count count
------- ---------------------------------------------------------------------
2985 2985
(1 row) (1 row)
SELECT avg(distinct l_orderkey) FROM lineitem_hash; SELECT avg(distinct l_orderkey) FROM lineitem_hash;
avg avg
----------------------- ---------------------------------------------------------------------
7463.9474036850921273 7463.9474036850921273
(1 row) (1 row)
-- Check that we support more complex expressions. -- Check that we support more complex expressions.
SELECT count(distinct (l_orderkey)) FROM lineitem_hash; SELECT count(distinct (l_orderkey)) FROM lineitem_hash;
count count
------- ---------------------------------------------------------------------
2985 2985
(1 row) (1 row)
SELECT count(distinct (l_orderkey + 1)) FROM lineitem_hash; SELECT count(distinct (l_orderkey + 1)) FROM lineitem_hash;
count count
------- ---------------------------------------------------------------------
2985 2985
(1 row) (1 row)
SELECT count(distinct (l_orderkey % 5)) FROM lineitem_hash; SELECT count(distinct (l_orderkey % 5)) FROM lineitem_hash;
count count
------- ---------------------------------------------------------------------
5 5
(1 row) (1 row)
-- count(distinct) on non-partition column is allowed -- count(distinct) on non-partition column is allowed
SELECT count(distinct l_partkey) FROM lineitem_hash; SELECT count(distinct l_partkey) FROM lineitem_hash;
count count
------- ---------------------------------------------------------------------
11661 11661
(1 row) (1 row)
SELECT count(distinct (l_partkey + 1)) FROM lineitem_hash; SELECT count(distinct (l_partkey + 1)) FROM lineitem_hash;
count count
------- ---------------------------------------------------------------------
11661 11661
(1 row) (1 row)
SELECT count(distinct (l_partkey % 5)) FROM lineitem_hash; SELECT count(distinct (l_partkey % 5)) FROM lineitem_hash;
count count
------- ---------------------------------------------------------------------
5 5
(1 row) (1 row)
@ -218,7 +220,7 @@ SELECT l_orderkey, count(distinct l_partkey) INTO range_results FROM lineitem_ra
-- they should return the same results -- they should return the same results
SELECT * FROM hash_results h, range_results r WHERE h.l_orderkey = r.l_orderkey AND h.count != r.count; SELECT * FROM hash_results h, range_results r WHERE h.l_orderkey = r.l_orderkey AND h.count != r.count;
l_orderkey | count | l_orderkey | count l_orderkey | count | l_orderkey | count
------------+-------+------------+------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- count(distinct) is allowed if we group by non-partition column -- count(distinct) is allowed if we group by non-partition column
@ -227,7 +229,7 @@ SELECT l_partkey, count(distinct l_orderkey) INTO range_results_np FROM lineitem
-- they should return the same results -- they should return the same results
SELECT * FROM hash_results_np h, range_results_np r WHERE h.l_partkey = r.l_partkey AND h.count != r.count; SELECT * FROM hash_results_np h, range_results_np r WHERE h.l_partkey = r.l_partkey AND h.count != r.count;
l_partkey | count | l_partkey | count l_partkey | count | l_partkey | count
-----------+-------+-----------+------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- other agg(distinct) are not allowed on non-partition columns even they are grouped -- other agg(distinct) are not allowed on non-partition columns even they are grouped

View File

@ -4,25 +4,25 @@
-- Test aggregate type conversions using sums of integers and division operator -- Test aggregate type conversions using sums of integers and division operator
SELECT sum(l_suppkey) FROM lineitem; SELECT sum(l_suppkey) FROM lineitem;
sum sum
---------- ---------------------------------------------------------------------
60617976 60617976
(1 row) (1 row)
SELECT sum(l_suppkey) / 2 FROM lineitem; SELECT sum(l_suppkey) / 2 FROM lineitem;
?column? ?column?
---------- ---------------------------------------------------------------------
30308988 30308988
(1 row) (1 row)
SELECT sum(l_suppkey) / 2::numeric FROM lineitem; SELECT sum(l_suppkey) / 2::numeric FROM lineitem;
?column? ?column?
----------------------- ---------------------------------------------------------------------
30308988.000000000000 30308988.000000000000
(1 row) (1 row)
SELECT sum(l_suppkey)::int8 / 2 FROM lineitem; SELECT sum(l_suppkey)::int8 / 2 FROM lineitem;
?column? ?column?
---------- ---------------------------------------------------------------------
30308988 30308988
(1 row) (1 row)
@ -35,18 +35,19 @@ CREATE TABLE aggregate_type (
interval_value interval not null); interval_value interval not null);
SELECT create_distributed_table('aggregate_type', 'float_value', 'append'); SELECT create_distributed_table('aggregate_type', 'float_value', 'append');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
SELECT master_create_empty_shard('aggregate_type') AS shardid \gset SELECT master_create_empty_shard('aggregate_type') AS shardid \gset
copy aggregate_type FROM '@abs_srcdir@/data/agg_type.data' with (append_to_shard :shardid); \set agg_type_data_file :abs_srcdir '/data/agg_type.data'
copy aggregate_type FROM :'agg_type_data_file' with (append_to_shard :shardid);
-- Test conversions using aggregates on floats and division -- Test conversions using aggregates on floats and division
SELECT min(float_value), max(float_value), SELECT min(float_value), max(float_value),
sum(float_value), count(float_value), avg(float_value) sum(float_value), count(float_value), avg(float_value)
FROM aggregate_type; FROM aggregate_type;
min | max | sum | count | avg min | max | sum | count | avg
-----+-----+------+-------+------- ---------------------------------------------------------------------
1 | 4.5 | 10.5 | 4 | 2.625 1 | 4.5 | 10.5 | 4 | 2.625
(1 row) (1 row)
@ -54,7 +55,7 @@ SELECT min(float_value) / 2, max(float_value) / 2,
sum(float_value) / 2, count(float_value) / 2, avg(float_value) / 2 sum(float_value) / 2, count(float_value) / 2, avg(float_value) / 2
FROM aggregate_type; FROM aggregate_type;
?column? | ?column? | ?column? | ?column? | ?column? ?column? | ?column? | ?column? | ?column? | ?column?
----------+----------+----------+----------+---------- ---------------------------------------------------------------------
0.5 | 2.25 | 5.25 | 2 | 1.3125 0.5 | 2.25 | 5.25 | 2 | 1.3125
(1 row) (1 row)
@ -63,7 +64,7 @@ SELECT min(double_value), max(double_value),
sum(double_value), count(double_value), avg(double_value) sum(double_value), count(double_value), avg(double_value)
FROM aggregate_type; FROM aggregate_type;
min | max | sum | count | avg min | max | sum | count | avg
-------+---------+----------+-------+----------- ---------------------------------------------------------------------
2.343 | 6.34343 | 15.79703 | 4 | 3.9492575 2.343 | 6.34343 | 15.79703 | 4 | 3.9492575
(1 row) (1 row)
@ -71,7 +72,7 @@ SELECT min(double_value) * 2, max(double_value) * 2,
sum(double_value) * 2, count(double_value) * 2, avg(double_value) * 2 sum(double_value) * 2, count(double_value) * 2, avg(double_value) * 2
FROM aggregate_type; FROM aggregate_type;
?column? | ?column? | ?column? | ?column? | ?column? ?column? | ?column? | ?column? | ?column? | ?column?
----------+----------+----------+----------+---------- ---------------------------------------------------------------------
4.686 | 12.68686 | 31.59406 | 8 | 7.898515 4.686 | 12.68686 | 31.59406 | 8 | 7.898515
(1 row) (1 row)
@ -82,7 +83,7 @@ SELECT min(interval_value), max(interval_value),
sum(interval_value), count(interval_value), avg(interval_value) sum(interval_value), count(interval_value), avg(interval_value)
FROM aggregate_type; FROM aggregate_type;
min | max | sum | count | avg min | max | sum | count | avg
-------------+------------+-------------+-------+------------- ---------------------------------------------------------------------
00:00:23.44 | 00:38:52.9 | 01:23:33.64 | 4 | 00:20:53.41 00:00:23.44 | 00:38:52.9 | 01:23:33.64 | 4 | 00:20:53.41
(1 row) (1 row)
@ -90,7 +91,7 @@ SELECT min(interval_value) / 2, max(interval_value) / 2,
sum(interval_value) / 2, count(interval_value) / 2, avg(interval_value) / 2 sum(interval_value) / 2, count(interval_value) / 2, avg(interval_value) / 2
FROM aggregate_type; FROM aggregate_type;
?column? | ?column? | ?column? | ?column? | ?column? ?column? | ?column? | ?column? | ?column? | ?column?
-------------+-------------+-------------+----------+-------------- ---------------------------------------------------------------------
00:00:11.72 | 00:19:26.45 | 00:41:46.82 | 2 | 00:10:26.705 00:00:11.72 | 00:19:26.45 | 00:41:46.82 | 2 | 00:10:26.705
(1 row) (1 row)

View File

@ -26,23 +26,24 @@ CREATE TABLE lineitem_alter (
WITH ( fillfactor = 80 ); WITH ( fillfactor = 80 );
SELECT create_distributed_table('lineitem_alter', 'l_orderkey', 'append'); SELECT create_distributed_table('lineitem_alter', 'l_orderkey', 'append');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
SELECT master_create_empty_shard('lineitem_alter') AS shardid \gset SELECT master_create_empty_shard('lineitem_alter') AS shardid \gset
copy lineitem_alter FROM '@abs_srcdir@/data/lineitem.1.data' with (delimiter '|', append_to_shard :shardid); \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
copy lineitem_alter FROM :'lineitem_1_data_file' with (delimiter '|', append_to_shard :shardid);
-- verify that the storage options made it to the table definitions -- verify that the storage options made it to the table definitions
SELECT relname, reloptions FROM pg_class WHERE relname = 'lineitem_alter'; SELECT relname, reloptions FROM pg_class WHERE relname = 'lineitem_alter';
relname | reloptions relname | reloptions
----------------+----------------- ---------------------------------------------------------------------
lineitem_alter | {fillfactor=80} lineitem_alter | {fillfactor=80}
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'lineitem_alter%' ORDER BY relname; SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'lineitem_alter%' ORDER BY relname;
relname | reloptions relname | reloptions
-----------------------+----------------- ---------------------------------------------------------------------
lineitem_alter_220000 | {fillfactor=80} lineitem_alter_220000 | {fillfactor=80}
(1 row) (1 row)
@ -61,7 +62,7 @@ FROM
JOIN pg_attribute ON (pc.oid = pg_attribute.attrelid) JOIN pg_attribute ON (pc.oid = pg_attribute.attrelid)
ORDER BY attnum; ORDER BY attnum;
attname | atttypid attname | atttypid
-----------------+------------------- ---------------------------------------------------------------------
tableoid | oid tableoid | oid
cmax | cid cmax | cid
xmax | xid xmax | xid
@ -94,7 +95,7 @@ ORDER BY attnum;
\c - - - :master_port \c - - - :master_port
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+----------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -120,32 +121,32 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineite
SELECT float_column, count(*) FROM lineitem_alter GROUP BY float_column; SELECT float_column, count(*) FROM lineitem_alter GROUP BY float_column;
float_column | count float_column | count
--------------+------- ---------------------------------------------------------------------
| 6000 | 6000
(1 row) (1 row)
SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1; SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1;
int_column1 | count int_column1 | count
-------------+------- ---------------------------------------------------------------------
1 | 6000 1 | 6000
(1 row) (1 row)
-- Verify that SET|DROP DEFAULT works -- Verify that SET|DROP DEFAULT works
ALTER TABLE lineitem_alter ALTER COLUMN float_column SET DEFAULT 1; ALTER TABLE lineitem_alter ALTER COLUMN float_column SET DEFAULT 1;
ALTER TABLE lineitem_alter ALTER COLUMN int_column1 DROP DEFAULT; ALTER TABLE lineitem_alter ALTER COLUMN int_column1 DROP DEFAULT;
-- \copy to verify that default values take effect -- COPY to verify that default values take effect
SELECT master_create_empty_shard('lineitem_alter') as shardid \gset SELECT master_create_empty_shard('lineitem_alter') as shardid \gset
copy 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 '|', append_to_shard :shardid); copy 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 :'lineitem_1_data_file' with (delimiter '|', append_to_shard :shardid);
SELECT float_column, count(*) FROM lineitem_alter GROUP BY float_column; SELECT float_column, count(*) FROM lineitem_alter GROUP BY float_column;
float_column | count float_column | count
--------------+------- ---------------------------------------------------------------------
| 6000 | 6000
1 | 6000 1 | 6000
(2 rows) (2 rows)
SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1; SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1;
int_column1 | count int_column1 | count
-------------+------- ---------------------------------------------------------------------
| 6000 | 6000
1 | 6000 1 | 6000
(2 rows) (2 rows)
@ -154,7 +155,7 @@ SELECT int_column1, count(*) FROM lineitem_alter GROUP BY int_column1;
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 SET NOT NULL; ALTER TABLE lineitem_alter ALTER COLUMN int_column2 SET NOT NULL;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+-------------------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -180,19 +181,19 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineite
-- Drop default so that NULLs will be inserted for this column -- Drop default so that NULLs will be inserted for this column
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP DEFAULT; ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP DEFAULT;
-- \copy should fail because it will try to insert NULLs for a NOT NULL column -- COPY should fail because it will try to insert NULLs for a NOT NULL column
-- Note, this operation will create a table on the workers but it won't be in the metadata -- Note, this operation will create a table on the workers but it won't be in the metadata
BEGIN; BEGIN;
SELECT master_create_empty_shard('lineitem_alter') as shardid \gset SELECT master_create_empty_shard('lineitem_alter') as shardid \gset
copy 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 '|', append_to_shard :shardid); copy 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 :'lineitem_1_data_file' with (delimiter '|', append_to_shard :shardid);
ERROR: null value in column "int_column2" of relation "lineitem_alter_220002" violates not-null constraint 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, 1996-03-13, 1996-02-12, 1996-03-22, DELIVER IN PERSON , TRUCK , egular courts above the, 1, null, null, null, null). DETAIL: Failing row contains (1, 155190, 7706, 1, 17.00, 21168.23, 0.04, 0.02, N, O, 1996-03-13, 1996-02-12, 1996-03-22, DELIVER IN PERSON , TRUCK , egular courts above the, 1, null, null, null, null).
END; END;
-- Verify that DROP NOT NULL works -- Verify that DROP NOT NULL works
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP NOT NULL; ALTER TABLE lineitem_alter ALTER COLUMN int_column2 DROP NOT NULL;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+----------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -216,19 +217,19 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineite
null_column | integer | null_column | integer |
(21 rows) (21 rows)
-- \copy should succeed now -- COPY should succeed now
SELECT master_create_empty_shard('lineitem_alter') as shardid \gset SELECT master_create_empty_shard('lineitem_alter') as shardid \gset
copy 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 '|', append_to_shard :shardid); copy 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 :'lineitem_1_data_file' with (delimiter '|', append_to_shard :shardid);
SELECT count(*) from lineitem_alter; SELECT count(*) from lineitem_alter;
count count
------- ---------------------------------------------------------------------
18000 18000
(1 row) (1 row)
-- Verify that SET DATA TYPE works -- Verify that SET DATA TYPE works
SELECT int_column2, pg_typeof(int_column2), count(*) from lineitem_alter GROUP BY int_column2; SELECT int_column2, pg_typeof(int_column2), count(*) from lineitem_alter GROUP BY int_column2;
int_column2 | pg_typeof | count int_column2 | pg_typeof | count
-------------+-----------+------- ---------------------------------------------------------------------
| integer | 6000 | integer | 6000
2 | integer | 12000 2 | integer | 12000
(2 rows) (2 rows)
@ -236,7 +237,7 @@ SELECT int_column2, pg_typeof(int_column2), count(*) from lineitem_alter GROUP B
ALTER TABLE lineitem_alter ALTER COLUMN int_column2 SET DATA TYPE FLOAT; ALTER TABLE lineitem_alter ALTER COLUMN int_column2 SET DATA TYPE FLOAT;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+----------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -262,7 +263,7 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineite
SELECT int_column2, pg_typeof(int_column2), count(*) from lineitem_alter GROUP BY int_column2; SELECT int_column2, pg_typeof(int_column2), count(*) from lineitem_alter GROUP BY int_column2;
int_column2 | pg_typeof | count int_column2 | pg_typeof | count
-------------+------------------+------- ---------------------------------------------------------------------
| double precision | 6000 | double precision | 6000
2 | double precision | 12000 2 | double precision | 12000
(2 rows) (2 rows)
@ -275,7 +276,7 @@ ALTER TABLE lineitem_alter DROP COLUMN date_column;
ALTER TABLE lineitem_alter RENAME COLUMN l_orderkey TO l_orderkey_renamed; ALTER TABLE lineitem_alter RENAME COLUMN l_orderkey TO l_orderkey_renamed;
SELECT SUM(l_orderkey_renamed) FROM lineitem_alter; SELECT SUM(l_orderkey_renamed) FROM lineitem_alter;
sum sum
---------- ---------------------------------------------------------------------
53620791 53620791
(1 row) (1 row)
@ -294,13 +295,13 @@ ALTER TABLE lineitem_alter DROP COLUMN IF EXISTS int_column2;
ALTER TABLE IF EXISTS lineitem_alter RENAME COLUMN l_orderkey_renamed TO l_orderkey; ALTER TABLE IF EXISTS lineitem_alter RENAME COLUMN l_orderkey_renamed TO l_orderkey;
SELECT SUM(l_orderkey) FROM lineitem_alter; SELECT SUM(l_orderkey) FROM lineitem_alter;
sum sum
---------- ---------------------------------------------------------------------
53620791 53620791
(1 row) (1 row)
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+----------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -325,7 +326,7 @@ ALTER TABLE lineitem_alter ADD COLUMN int_column1 INTEGER,
ADD COLUMN int_column2 INTEGER; ADD COLUMN int_column2 INTEGER;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+----------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -354,7 +355,7 @@ DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT, ADD|DROP|VAL
ALTER TABLE lineitem_alter DROP COLUMN int_column1, DROP COLUMN int_column2; ALTER TABLE lineitem_alter DROP COLUMN int_column1, DROP COLUMN int_column2;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+----------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -392,11 +393,9 @@ DETAIL: Only ADD|DROP COLUMN, SET|DROP NOT NULL, SET|DROP DEFAULT, ADD|DROP|VAL
-- types -- types
ALTER TABLE lineitem_alter ADD COLUMN new_column non_existent_type; ALTER TABLE lineitem_alter ADD COLUMN new_column non_existent_type;
ERROR: type "non_existent_type" does not exist ERROR: type "non_existent_type" does not exist
LINE 1: ALTER TABLE lineitem_alter ADD COLUMN new_column non_existen...
^
ALTER TABLE lineitem_alter ALTER COLUMN null_column SET NOT NULL; ALTER TABLE lineitem_alter ALTER COLUMN null_column SET NOT NULL;
ERROR: column "null_column" of relation "lineitem_alter_220000" contains null values ERROR: column "null_column" contains null values
CONTEXT: while executing command on localhost:57637 CONTEXT: while executing command on localhost:xxxxx
ALTER TABLE lineitem_alter ALTER COLUMN l_partkey SET DEFAULT 'a'; ALTER TABLE lineitem_alter ALTER COLUMN l_partkey SET DEFAULT 'a';
ERROR: invalid input syntax for type integer: "a" ERROR: invalid input syntax for type integer: "a"
-- Verify that we error out on RENAME CONSTRAINT statement -- Verify that we error out on RENAME CONSTRAINT statement
@ -413,7 +412,7 @@ NOTICE: relation "non_existent_table" does not exist, skipping
-- node -- node
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+----------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -440,7 +439,7 @@ CREATE INDEX temp_index_1 ON lineitem_alter(l_linenumber);
COMMIT; COMMIT;
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
--------------+---------------- ---------------------------------------------------------------------
temp_index_1 | lineitem_alter temp_index_1 | lineitem_alter
(1 row) (1 row)
@ -452,7 +451,7 @@ CREATE INDEX temp_index_2 ON lineitem_alter(l_orderkey);
COMMIT; COMMIT;
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
--------------+---------------- ---------------------------------------------------------------------
temp_index_2 | lineitem_alter temp_index_2 | lineitem_alter
(1 row) (1 row)
@ -464,7 +463,7 @@ ALTER TABLE lineitem_alter ADD COLUMN first integer;
COMMIT; COMMIT;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass; SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
Column | Type | Modifiers Column | Type | Modifiers
-----------------+-----------------------+----------- ---------------------------------------------------------------------
l_orderkey | bigint | not null l_orderkey | bigint | not null
l_partkey | integer | not null l_partkey | integer | not null
l_suppkey | integer | not null l_suppkey | integer | not null
@ -488,7 +487,7 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineite
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'temp_index_2'::regclass; relid = 'temp_index_2'::regclass;
Column | Type | Definition Column | Type | Definition
------------+--------+------------ ---------------------------------------------------------------------
l_orderkey | bigint | l_orderkey l_orderkey | bigint | l_orderkey
(1 row) (1 row)
@ -501,7 +500,7 @@ CREATE INDEX temp_index_3 ON lineitem_alter(l_partkey);
ROLLBACK; ROLLBACK;
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
-----------+----------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- ensure that errors cause full rollback -- ensure that errors cause full rollback
@ -512,7 +511,7 @@ ERROR: relation "temp_index_2" already exists
ROLLBACK; ROLLBACK;
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
-----------+----------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- verify that SAVEPOINT is allowed... -- verify that SAVEPOINT is allowed...
@ -530,7 +529,7 @@ ROLLBACK TO my_savepoint;
COMMIT; COMMIT;
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
--------------+---------------- ---------------------------------------------------------------------
temp_index_2 | lineitem_alter temp_index_2 | lineitem_alter
(1 row) (1 row)
@ -544,12 +543,12 @@ BEGIN;
CREATE INDEX temp_index_2 ON lineitem_alter(l_orderkey); CREATE INDEX temp_index_2 ON lineitem_alter(l_orderkey);
ALTER TABLE lineitem_alter ADD COLUMN first integer; ALTER TABLE lineitem_alter ADD COLUMN first integer;
ERROR: column "first" of relation "lineitem_alter_220000" already exists ERROR: column "first" of relation "lineitem_alter_220000" already exists
CONTEXT: while executing command on localhost:57638 CONTEXT: while executing command on localhost:xxxxx
COMMIT; COMMIT;
-- Nothing from the block should have committed -- Nothing from the block should have committed
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
-----------+----------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- Create single-shard table (to avoid deadlocks in the upcoming test hackery) -- Create single-shard table (to avoid deadlocks in the upcoming test hackery)
@ -558,7 +557,7 @@ SET citus.shard_count TO 1;
SET citus.shard_replication_factor TO 2; SET citus.shard_replication_factor TO 2;
SELECT create_distributed_table('single_shard_items', 'id', 'hash'); SELECT create_distributed_table('single_shard_items', 'id', 'hash');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -566,13 +565,13 @@ SELECT create_distributed_table('single_shard_items', 'id', 'hash');
CREATE UNIQUE INDEX replica_idx on single_shard_items(id); CREATE UNIQUE INDEX replica_idx on single_shard_items(id);
SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items'; SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items';
relreplident relreplident
-------------- ---------------------------------------------------------------------
d d
(1 row) (1 row)
SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;'); SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;');
run_command_on_workers run_command_on_workers
------------------------ ---------------------------------------------------------------------
(localhost,57637,t,d) (localhost,57637,t,d)
(localhost,57638,t,d) (localhost,57638,t,d)
(2 rows) (2 rows)
@ -580,13 +579,13 @@ SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname L
ALTER TABLE single_shard_items REPLICA IDENTITY nothing; ALTER TABLE single_shard_items REPLICA IDENTITY nothing;
SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items'; SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items';
relreplident relreplident
-------------- ---------------------------------------------------------------------
n n
(1 row) (1 row)
SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;'); SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;');
run_command_on_workers run_command_on_workers
------------------------ ---------------------------------------------------------------------
(localhost,57637,t,n) (localhost,57637,t,n)
(localhost,57638,t,n) (localhost,57638,t,n)
(2 rows) (2 rows)
@ -594,13 +593,13 @@ SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname L
ALTER TABLE single_shard_items REPLICA IDENTITY full; ALTER TABLE single_shard_items REPLICA IDENTITY full;
SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items'; SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items';
relreplident relreplident
-------------- ---------------------------------------------------------------------
f f
(1 row) (1 row)
SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;'); SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;');
run_command_on_workers run_command_on_workers
------------------------ ---------------------------------------------------------------------
(localhost,57637,t,f) (localhost,57637,t,f)
(localhost,57638,t,f) (localhost,57638,t,f)
(2 rows) (2 rows)
@ -608,13 +607,13 @@ SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname L
ALTER TABLE single_shard_items REPLICA IDENTITY USING INDEX replica_idx; ALTER TABLE single_shard_items REPLICA IDENTITY USING INDEX replica_idx;
SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items'; SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items';
relreplident relreplident
-------------- ---------------------------------------------------------------------
i i
(1 row) (1 row)
SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;'); SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;');
run_command_on_workers run_command_on_workers
------------------------ ---------------------------------------------------------------------
(localhost,57637,t,i) (localhost,57637,t,i)
(localhost,57638,t,i) (localhost,57638,t,i)
(2 rows) (2 rows)
@ -622,13 +621,13 @@ SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname L
ALTER TABLE single_shard_items REPLICA IDENTITY default, REPLICA IDENTITY USING INDEX replica_idx, REPLICA IDENTITY nothing; ALTER TABLE single_shard_items REPLICA IDENTITY default, REPLICA IDENTITY USING INDEX replica_idx, REPLICA IDENTITY nothing;
SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items'; SELECT relreplident FROM pg_class WHERE relname = 'single_shard_items';
relreplident relreplident
-------------- ---------------------------------------------------------------------
n n
(1 row) (1 row)
SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;'); SELECT run_command_on_workers('SELECT relreplident FROM pg_class WHERE relname LIKE ''single_shard_items_%'' LIMIT 1;');
run_command_on_workers run_command_on_workers
------------------------ ---------------------------------------------------------------------
(localhost,57637,t,n) (localhost,57637,t,n)
(localhost,57638,t,n) (localhost,57638,t,n)
(2 rows) (2 rows)
@ -659,11 +658,11 @@ CREATE INDEX single_index_3 ON single_shard_items(name);
COMMIT; COMMIT;
ERROR: duplicate key value violates unique constraint "ddl_commands_command_key" ERROR: duplicate key value violates unique constraint "ddl_commands_command_key"
DETAIL: Key (command)=(CREATE INDEX) already exists. DETAIL: Key (command)=(CREATE INDEX) already exists.
CONTEXT: while executing command on localhost:57638 CONTEXT: while executing command on localhost:xxxxx
-- Nothing from the block should have committed -- Nothing from the block should have committed
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'single_shard_items' ORDER BY 1; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'single_shard_items' ORDER BY 1;
indexname | tablename indexname | tablename
-----------+----------- ---------------------------------------------------------------------
(0 rows) (0 rows)
\c - - - :worker_2_port \c - - - :worker_2_port
@ -676,7 +675,7 @@ BEGIN;
CREATE INDEX temp_index_2 ON lineitem_alter(l_orderkey); CREATE INDEX temp_index_2 ON lineitem_alter(l_orderkey);
SELECT count(*) FROM lineitem_alter; SELECT count(*) FROM lineitem_alter;
count count
------- ---------------------------------------------------------------------
18000 18000
(1 row) (1 row)
@ -685,7 +684,7 @@ ROLLBACK;
BEGIN; BEGIN;
SELECT count(*) FROM lineitem_alter; SELECT count(*) FROM lineitem_alter;
count count
------- ---------------------------------------------------------------------
18000 18000
(1 row) (1 row)
@ -693,7 +692,7 @@ CREATE INDEX temp_index_2 ON lineitem_alter(l_orderkey);
COMMIT; COMMIT;
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
--------------+---------------- ---------------------------------------------------------------------
temp_index_2 | lineitem_alter temp_index_2 | lineitem_alter
(1 row) (1 row)
@ -703,14 +702,14 @@ DROP INDEX temp_index_2;
CREATE INDEX temp_index_3 ON lineitem_alter(l_orderkey); CREATE INDEX temp_index_3 ON lineitem_alter(l_orderkey);
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
--------------+---------------- ---------------------------------------------------------------------
temp_index_3 | lineitem_alter temp_index_3 | lineitem_alter
(1 row) (1 row)
DROP INDEX temp_index_3; DROP INDEX temp_index_3;
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
-----------+----------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- verify that not any of shard placements are marked as failed when a query failure occurs -- verify that not any of shard placements are marked as failed when a query failure occurs
@ -718,7 +717,7 @@ CREATE TABLE test_ab (a int, b int);
SET citus.shard_count TO 8; SET citus.shard_count TO 8;
SELECT create_distributed_table('test_ab', 'a', 'hash'); SELECT create_distributed_table('test_ab', 'a', 'hash');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -727,11 +726,11 @@ INSERT INTO test_ab VALUES (2, 11);
CREATE UNIQUE INDEX temp_unique_index_1 ON test_ab(a); CREATE UNIQUE INDEX temp_unique_index_1 ON test_ab(a);
ERROR: could not create unique index "temp_unique_index_1_220011" ERROR: could not create unique index "temp_unique_index_1_220011"
DETAIL: Key (a)=(2) is duplicated. DETAIL: Key (a)=(2) is duplicated.
CONTEXT: while executing command on localhost:57638 CONTEXT: while executing command on localhost:xxxxx
SELECT shardid FROM pg_dist_shard_placement NATURAL JOIN pg_dist_shard SELECT shardid FROM pg_dist_shard_placement NATURAL JOIN pg_dist_shard
WHERE logicalrelid='test_ab'::regclass AND shardstate=3; WHERE logicalrelid='test_ab'::regclass AND shardstate=3;
shardid shardid
--------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- Check that the schema on the worker still looks reasonable -- Check that the schema on the worker still looks reasonable
@ -742,7 +741,7 @@ FROM
JOIN pg_attribute ON (pc.oid = pg_attribute.attrelid) JOIN pg_attribute ON (pc.oid = pg_attribute.attrelid)
ORDER BY attnum; ORDER BY attnum;
attname | atttypid attname | atttypid
-------------------------------+------------------- ---------------------------------------------------------------------
tableoid | oid tableoid | oid
cmax | cid cmax | cid
xmax | xid xmax | xid
@ -779,7 +778,7 @@ ORDER BY attnum;
-- verify that we can rename distributed tables -- verify that we can rename distributed tables
SHOW citus.enable_ddl_propagation; SHOW citus.enable_ddl_propagation;
citus.enable_ddl_propagation citus.enable_ddl_propagation
------------------------------ ---------------------------------------------------------------------
on on
(1 row) (1 row)
@ -787,7 +786,7 @@ ALTER TABLE lineitem_alter RENAME TO lineitem_renamed;
-- verify rename is performed -- verify rename is performed
SELECT relname FROM pg_class WHERE relname = 'lineitem_renamed'; SELECT relname FROM pg_class WHERE relname = 'lineitem_renamed';
relname relname
------------------ ---------------------------------------------------------------------
lineitem_renamed lineitem_renamed
(1 row) (1 row)
@ -795,7 +794,7 @@ SELECT relname FROM pg_class WHERE relname = 'lineitem_renamed';
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname FROM pg_class WHERE relname LIKE 'lineitem_renamed%' ORDER BY relname; SELECT relname FROM pg_class WHERE relname LIKE 'lineitem_renamed%' ORDER BY relname;
relname relname
------------------------- ---------------------------------------------------------------------
lineitem_renamed_220000 lineitem_renamed_220000
lineitem_renamed_220001 lineitem_renamed_220001
lineitem_renamed_220003 lineitem_renamed_220003
@ -808,7 +807,7 @@ ALTER TABLE lineitem_renamed RENAME TO lineitem_alter;
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname FROM pg_class WHERE relname LIKE 'lineitem_alter%' AND relname <> 'lineitem_alter_220002' /* failed copy trails */ ORDER BY relname; SELECT relname FROM pg_class WHERE relname LIKE 'lineitem_alter%' AND relname <> 'lineitem_alter_220002' /* failed copy trails */ ORDER BY relname;
relname relname
----------------------- ---------------------------------------------------------------------
lineitem_alter_220000 lineitem_alter_220000
lineitem_alter_220001 lineitem_alter_220001
lineitem_alter_220003 lineitem_alter_220003
@ -819,14 +818,14 @@ SELECT relname FROM pg_class WHERE relname LIKE 'lineitem_alter%' AND relname <>
ALTER TABLE lineitem_alter SET(fillfactor=40); ALTER TABLE lineitem_alter SET(fillfactor=40);
SELECT relname, reloptions FROM pg_class WHERE relname = 'lineitem_alter'; SELECT relname, reloptions FROM pg_class WHERE relname = 'lineitem_alter';
relname | reloptions relname | reloptions
----------------+----------------- ---------------------------------------------------------------------
lineitem_alter | {fillfactor=40} lineitem_alter | {fillfactor=40}
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'lineitem_alter%' AND relname <> 'lineitem_alter_220002' /* failed copy trails */ ORDER BY relname; SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'lineitem_alter%' AND relname <> 'lineitem_alter_220002' /* failed copy trails */ ORDER BY relname;
relname | reloptions relname | reloptions
-----------------------+----------------- ---------------------------------------------------------------------
lineitem_alter_220000 | {fillfactor=40} lineitem_alter_220000 | {fillfactor=40}
lineitem_alter_220001 | {fillfactor=40} lineitem_alter_220001 | {fillfactor=40}
lineitem_alter_220003 | {fillfactor=40} lineitem_alter_220003 | {fillfactor=40}
@ -836,14 +835,14 @@ SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'lineitem_alter%' AN
ALTER TABLE lineitem_alter RESET(fillfactor); ALTER TABLE lineitem_alter RESET(fillfactor);
SELECT relname, reloptions FROM pg_class WHERE relname = 'lineitem_alter'; SELECT relname, reloptions FROM pg_class WHERE relname = 'lineitem_alter';
relname | reloptions relname | reloptions
----------------+------------ ---------------------------------------------------------------------
lineitem_alter | lineitem_alter |
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'lineitem_alter%' AND relname <> 'lineitem_alter_220002' /* failed copy trails */ ORDER BY relname; SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'lineitem_alter%' AND relname <> 'lineitem_alter_220002' /* failed copy trails */ ORDER BY relname;
relname | reloptions relname | reloptions
-----------------------+------------ ---------------------------------------------------------------------
lineitem_alter_220000 | lineitem_alter_220000 |
lineitem_alter_220001 | lineitem_alter_220001 |
lineitem_alter_220003 | lineitem_alter_220003 |
@ -856,7 +855,7 @@ ALTER INDEX temp_index_1 RENAME TO idx_lineitem_linenumber;
-- verify rename is performed -- verify rename is performed
SELECT relname FROM pg_class WHERE relname = 'idx_lineitem_linenumber'; SELECT relname FROM pg_class WHERE relname = 'idx_lineitem_linenumber';
relname relname
------------------------- ---------------------------------------------------------------------
idx_lineitem_linenumber idx_lineitem_linenumber
(1 row) (1 row)
@ -864,7 +863,7 @@ SELECT relname FROM pg_class WHERE relname = 'idx_lineitem_linenumber';
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname FROM pg_class WHERE relname LIKE 'idx_lineitem_linenumber%' ORDER BY relname; SELECT relname FROM pg_class WHERE relname LIKE 'idx_lineitem_linenumber%' ORDER BY relname;
relname relname
-------------------------------- ---------------------------------------------------------------------
idx_lineitem_linenumber_220000 idx_lineitem_linenumber_220000
idx_lineitem_linenumber_220001 idx_lineitem_linenumber_220001
idx_lineitem_linenumber_220003 idx_lineitem_linenumber_220003
@ -880,7 +879,7 @@ ALTER TABLE lineitem_alter RENAME TO lineitem_renamed;
-- verify rename is performed -- verify rename is performed
SELECT relname FROM pg_class WHERE relname = 'lineitem_alter' or relname = 'lineitem_renamed'; SELECT relname FROM pg_class WHERE relname = 'lineitem_alter' or relname = 'lineitem_renamed';
relname relname
------------------ ---------------------------------------------------------------------
lineitem_renamed lineitem_renamed
(1 row) (1 row)
@ -892,15 +891,13 @@ ALTER TABLE lineitem_alter ADD COLUMN column_only_added_to_master int;
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT column_only_added_to_master FROM lineitem_alter_220000 LIMIT 0; SELECT column_only_added_to_master FROM lineitem_alter_220000 LIMIT 0;
ERROR: column "column_only_added_to_master" does not exist ERROR: column "column_only_added_to_master" does not exist
LINE 1: SELECT column_only_added_to_master FROM lineitem_alter_22000...
^
\c - - - :master_port \c - - - :master_port
-- ddl propagation flag is reset to default, disable it again -- ddl propagation flag is reset to default, disable it again
SET citus.enable_ddl_propagation to false; SET citus.enable_ddl_propagation to false;
-- following query succeeds since it accesses an previously existing column -- following query succeeds since it accesses an previously existing column
SELECT l_orderkey FROM lineitem_alter LIMIT 0; SELECT l_orderkey FROM lineitem_alter LIMIT 0;
l_orderkey l_orderkey
------------ ---------------------------------------------------------------------
(0 rows) (0 rows)
-- make master and workers have the same schema again -- make master and workers have the same schema again
@ -908,7 +905,7 @@ ALTER TABLE lineitem_alter DROP COLUMN column_only_added_to_master;
-- now this should succeed -- now this should succeed
SELECT * FROM lineitem_alter LIMIT 0; SELECT * FROM lineitem_alter LIMIT 0;
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 | null_column 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 | null_column
------------+-----------+-----------+--------------+------------+-----------------+------------+-------+--------------+--------------+------------+--------------+---------------+----------------+------------+-----------+------------- ---------------------------------------------------------------------
(0 rows) (0 rows)
-- previously unsupported statements are accepted by postgresql now -- previously unsupported statements are accepted by postgresql now
@ -924,7 +921,7 @@ ERROR: cannot execute ALTER TABLE command dropping partition column
CREATE UNIQUE INDEX unique_lineitem_partkey on lineitem_alter(l_partkey); CREATE UNIQUE INDEX unique_lineitem_partkey on lineitem_alter(l_partkey);
SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter'; SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
indexname | tablename indexname | tablename
-------------------------+---------------- ---------------------------------------------------------------------
unique_lineitem_partkey | lineitem_alter unique_lineitem_partkey | lineitem_alter
(1 row) (1 row)
@ -932,7 +929,7 @@ SELECT indexname, tablename FROM pg_indexes WHERE tablename = 'lineitem_alter';
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT indexname, tablename FROM pg_indexes WHERE tablename like 'lineitem_alter_%'; SELECT indexname, tablename FROM pg_indexes WHERE tablename like 'lineitem_alter_%';
indexname | tablename indexname | tablename
-----------+----------- ---------------------------------------------------------------------
(0 rows) (0 rows)
\c - - - :master_port \c - - - :master_port
@ -942,7 +939,7 @@ SET citus.shard_replication_factor TO 2;
CREATE TABLE sequence_deadlock_test (a serial, b serial); CREATE TABLE sequence_deadlock_test (a serial, b serial);
SELECT create_distributed_table('sequence_deadlock_test', 'a'); SELECT create_distributed_table('sequence_deadlock_test', 'a');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -963,7 +960,7 @@ CREATE TABLE trigger_table (
); );
SELECT create_distributed_table('trigger_table', 'id'); SELECT create_distributed_table('trigger_table', 'id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -984,7 +981,7 @@ FOR EACH ROW EXECUTE PROCEDURE update_value();
INSERT INTO trigger_table VALUES (1, 'trigger disabled'); INSERT INTO trigger_table VALUES (1, 'trigger disabled');
SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value; SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value;
value | count value | count
-----------------+------- ---------------------------------------------------------------------
trigger enabled | 1 trigger enabled | 1
(1 row) (1 row)
@ -993,7 +990,7 @@ ERROR: triggers are not supported on distributed tables when "citus.enable_unsa
INSERT INTO trigger_table VALUES (1, 'trigger disabled'); INSERT INTO trigger_table VALUES (1, 'trigger disabled');
SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value; SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value;
value | count value | count
-----------------+------- ---------------------------------------------------------------------
trigger enabled | 2 trigger enabled | 2
(1 row) (1 row)
@ -1002,14 +999,15 @@ ERROR: triggers are not supported on distributed tables when "citus.enable_unsa
INSERT INTO trigger_table VALUES (1, 'trigger disabled'); INSERT INTO trigger_table VALUES (1, 'trigger disabled');
SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value; SELECT value, count(*) FROM trigger_table GROUP BY value ORDER BY value;
value | count value | count
-----------------+------- ---------------------------------------------------------------------
trigger enabled | 3 trigger enabled | 3
(1 row) (1 row)
DROP TABLE trigger_table; DROP TABLE trigger_table;
-- test ALTER TABLE ALL IN TABLESPACE -- test ALTER TABLE ALL IN TABLESPACE
-- we expect that it will warn out -- we expect that it will warn out
CREATE TABLESPACE super_fast_ssd LOCATION '@abs_srcdir@/data'; \set tablespace_location :abs_srcdir '/data'
CREATE TABLESPACE super_fast_ssd LOCATION :'tablespace_location';
ALTER TABLE ALL IN TABLESPACE pg_default SET TABLESPACE super_fast_ssd; ALTER TABLE ALL IN TABLESPACE pg_default SET TABLESPACE super_fast_ssd;
WARNING: not propagating ALTER TABLE ALL IN TABLESPACE commands to worker nodes WARNING: not propagating ALTER TABLE ALL IN TABLESPACE commands to worker nodes
HINT: Connect to worker nodes directly to manually move all tables. HINT: Connect to worker nodes directly to manually move all tables.
@ -1034,7 +1032,7 @@ ALTER TABLE lineitem_alter OWNER TO alter_table_owner;
-- should be able to query the table as table owner -- should be able to query the table as table owner
SELECT count(*) FROM lineitem_alter; SELECT count(*) FROM lineitem_alter;
count count
------- ---------------------------------------------------------------------
18000 18000
(1 row) (1 row)
@ -1045,7 +1043,7 @@ DROP TABLE lineitem_alter;
\c - postgres - :worker_1_port \c - postgres - :worker_1_port
SELECT relname FROM pg_class WHERE relname LIKE 'lineitem_alter%'; SELECT relname FROM pg_class WHERE relname LIKE 'lineitem_alter%';
relname relname
----------------------- ---------------------------------------------------------------------
lineitem_alter_220002 lineitem_alter_220002
(1 row) (1 row)
@ -1058,7 +1056,7 @@ BEGIN;
CREATE TABLE test_table_1(id int); CREATE TABLE test_table_1(id int);
SELECT create_distributed_table('test_table_1','id'); SELECT create_distributed_table('test_table_1','id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -1069,7 +1067,7 @@ END;
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname FROM pg_class WHERE relname LIKE 'test_table_1%'; SELECT relname FROM pg_class WHERE relname LIKE 'test_table_1%';
relname relname
--------- ---------------------------------------------------------------------
(0 rows) (0 rows)
\c - - - :master_port \c - - - :master_port
@ -1078,14 +1076,14 @@ CREATE TABLE logged_test(id int);
ALTER TABLE logged_test SET UNLOGGED; ALTER TABLE logged_test SET UNLOGGED;
SELECT create_distributed_table('logged_test', 'id'); SELECT create_distributed_table('logged_test', 'id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test_' ORDER BY relname; SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test_' ORDER BY relname;
relname | logged_info relname | logged_info
--------------------+------------- ---------------------------------------------------------------------
logged_test_220022 | unlogged logged_test_220022 | unlogged
logged_test_220023 | unlogged logged_test_220023 | unlogged
logged_test_220024 | unlogged logged_test_220024 | unlogged
@ -1097,14 +1095,14 @@ SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logg
ALTER TABLE logged_test SET LOGGED; ALTER TABLE logged_test SET LOGGED;
SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test*' ORDER BY relname; SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test*' ORDER BY relname;
relname | logged_info relname | logged_info
-------------+------------- ---------------------------------------------------------------------
logged_test | logged logged_test | logged
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test_' ORDER BY relname; SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test_' ORDER BY relname;
relname | logged_info relname | logged_info
--------------------+------------- ---------------------------------------------------------------------
logged_test_220022 | logged logged_test_220022 | logged
logged_test_220023 | logged logged_test_220023 | logged
logged_test_220024 | logged logged_test_220024 | logged
@ -1115,14 +1113,14 @@ SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logg
ALTER TABLE logged_test SET UNLOGGED; ALTER TABLE logged_test SET UNLOGGED;
SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test*' ORDER BY relname; SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test*' ORDER BY relname;
relname | logged_info relname | logged_info
-------------+------------- ---------------------------------------------------------------------
logged_test | unlogged logged_test | unlogged
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test_' ORDER BY relname; SELECT relname, CASE relpersistence WHEN 'u' THEN 'unlogged' WHEN 'p' then 'logged' ELSE 'unknown' END AS logged_info FROM pg_class WHERE relname ~ 'logged_test_' ORDER BY relname;
relname | logged_info relname | logged_info
--------------------+------------- ---------------------------------------------------------------------
logged_test_220022 | unlogged logged_test_220022 | unlogged
logged_test_220023 | unlogged logged_test_220023 | unlogged
logged_test_220024 | unlogged logged_test_220024 | unlogged
@ -1135,21 +1133,21 @@ DROP TABLE logged_test;
CREATE TABLE hash_dist(id bigint primary key, f1 text) WITH (fillfactor=40); CREATE TABLE hash_dist(id bigint primary key, f1 text) WITH (fillfactor=40);
SELECT create_distributed_table('hash_dist','id'); SELECT create_distributed_table('hash_dist','id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
-- verify that the storage options made it to the table definitions -- verify that the storage options made it to the table definitions
SELECT relname, reloptions FROM pg_class WHERE relname = 'hash_dist'; SELECT relname, reloptions FROM pg_class WHERE relname = 'hash_dist';
relname | reloptions relname | reloptions
-----------+----------------- ---------------------------------------------------------------------
hash_dist | {fillfactor=40} hash_dist | {fillfactor=40}
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, reloptions FROM pg_class WHERE relkind = 'r' AND relname LIKE 'hash_dist_%' ORDER BY relname; SELECT relname, reloptions FROM pg_class WHERE relkind = 'r' AND relname LIKE 'hash_dist_%' ORDER BY relname;
relname | reloptions relname | reloptions
------------------+----------------- ---------------------------------------------------------------------
hash_dist_220026 | {fillfactor=40} hash_dist_220026 | {fillfactor=40}
hash_dist_220027 | {fillfactor=40} hash_dist_220027 | {fillfactor=40}
hash_dist_220028 | {fillfactor=40} hash_dist_220028 | {fillfactor=40}
@ -1161,14 +1159,14 @@ SELECT relname, reloptions FROM pg_class WHERE relkind = 'r' AND relname LIKE 'h
ALTER INDEX hash_dist_pkey SET(fillfactor=40); ALTER INDEX hash_dist_pkey SET(fillfactor=40);
SELECT relname, reloptions FROM pg_class WHERE relname = 'hash_dist_pkey'; SELECT relname, reloptions FROM pg_class WHERE relname = 'hash_dist_pkey';
relname | reloptions relname | reloptions
----------------+----------------- ---------------------------------------------------------------------
hash_dist_pkey | {fillfactor=40} hash_dist_pkey | {fillfactor=40}
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'hash_dist_pkey_%' ORDER BY relname; SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'hash_dist_pkey_%' ORDER BY relname;
relname | reloptions relname | reloptions
-----------------------+----------------- ---------------------------------------------------------------------
hash_dist_pkey_220026 | {fillfactor=40} hash_dist_pkey_220026 | {fillfactor=40}
hash_dist_pkey_220027 | {fillfactor=40} hash_dist_pkey_220027 | {fillfactor=40}
hash_dist_pkey_220028 | {fillfactor=40} hash_dist_pkey_220028 | {fillfactor=40}
@ -1179,14 +1177,14 @@ SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'hash_dist_pkey_%' O
ALTER INDEX hash_dist_pkey RESET(fillfactor); ALTER INDEX hash_dist_pkey RESET(fillfactor);
SELECT relname, reloptions FROM pg_class WHERE relname = 'hash_dist_pkey'; SELECT relname, reloptions FROM pg_class WHERE relname = 'hash_dist_pkey';
relname | reloptions relname | reloptions
----------------+------------ ---------------------------------------------------------------------
hash_dist_pkey | hash_dist_pkey |
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'hash_dist_pkey_%' ORDER BY relname; SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'hash_dist_pkey_%' ORDER BY relname;
relname | reloptions relname | reloptions
-----------------------+------------ ---------------------------------------------------------------------
hash_dist_pkey_220026 | hash_dist_pkey_220026 |
hash_dist_pkey_220027 | hash_dist_pkey_220027 |
hash_dist_pkey_220028 | hash_dist_pkey_220028 |
@ -1203,14 +1201,14 @@ CREATE UNIQUE INDEX another_index ON hash_dist(id) WITH (fillfactor=50);
-- show the index and its storage options on coordinator, then workers -- show the index and its storage options on coordinator, then workers
SELECT relname, reloptions FROM pg_class WHERE relname = 'another_index'; SELECT relname, reloptions FROM pg_class WHERE relname = 'another_index';
relname | reloptions relname | reloptions
---------------+----------------- ---------------------------------------------------------------------
another_index | {fillfactor=50} another_index | {fillfactor=50}
(1 row) (1 row)
\c - - - :worker_1_port \c - - - :worker_1_port
SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'another_index_%' ORDER BY relname; SELECT relname, reloptions FROM pg_class WHERE relname LIKE 'another_index_%' ORDER BY relname;
relname | reloptions relname | reloptions
----------------------+----------------- ---------------------------------------------------------------------
another_index_220026 | {fillfactor=50} another_index_220026 | {fillfactor=50}
another_index_220027 | {fillfactor=50} another_index_220027 | {fillfactor=50}
another_index_220028 | {fillfactor=50} another_index_220028 | {fillfactor=50}
@ -1227,7 +1225,7 @@ SET citus.shard_replication_factor TO 1;
CREATE TABLE test_table_1(id int); CREATE TABLE test_table_1(id int);
SELECT create_distributed_table('test_table_1', 'id'); SELECT create_distributed_table('test_table_1', 'id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -1244,7 +1242,7 @@ HINT: You can issue each command separately such as ALTER TABLE test_table_1 AD
CREATE TABLE reference_table(i int UNIQUE); CREATE TABLE reference_table(i int UNIQUE);
SELECT create_reference_table('reference_table'); SELECT create_reference_table('reference_table');
create_reference_table create_reference_table
------------------------ ---------------------------------------------------------------------
(1 row) (1 row)
@ -1260,7 +1258,7 @@ DROP TABLE reference_table;
CREATE TABLE referenced_table(i int UNIQUE); CREATE TABLE referenced_table(i int UNIQUE);
SELECT create_distributed_table('referenced_table', 'i'); SELECT create_distributed_table('referenced_table', 'i');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -1272,7 +1270,7 @@ DROP TABLE referenced_table, test_table_1;
CREATE TABLE table_without_sequence(a int); CREATE TABLE table_without_sequence(a int);
SELECT create_distributed_table('table_without_sequence', 'a'); SELECT create_distributed_table('table_without_sequence', 'a');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -1282,13 +1280,13 @@ ALTER TABLE table_without_sequence ADD COLUMN x BIGINT DEFAULT nextval('test_sch
-- Should be distributed along with the sequence -- Should be distributed along with the sequence
SELECT pg_identify_object_as_address(classid, objid, objsubid) from pg_catalog.pg_dist_object WHERE objid IN ('test_schema_for_sequence_propagation.seq_10'::regclass); SELECT pg_identify_object_as_address(classid, objid, objsubid) from pg_catalog.pg_dist_object WHERE objid IN ('test_schema_for_sequence_propagation.seq_10'::regclass);
pg_identify_object_as_address pg_identify_object_as_address
--------------------------------------------------------------- ---------------------------------------------------------------------
(sequence,"{test_schema_for_sequence_propagation,seq_10}",{}) (sequence,"{test_schema_for_sequence_propagation,seq_10}",{})
(1 row) (1 row)
SELECT pg_identify_object_as_address(classid, objid, objsubid) from pg_catalog.pg_dist_object WHERE objid IN ('test_schema_for_sequence_propagation'::regnamespace); SELECT pg_identify_object_as_address(classid, objid, objsubid) from pg_catalog.pg_dist_object WHERE objid IN ('test_schema_for_sequence_propagation'::regnamespace);
pg_identify_object_as_address pg_identify_object_as_address
---------------------------------------------------- ---------------------------------------------------------------------
(schema,{test_schema_for_sequence_propagation},{}) (schema,{test_schema_for_sequence_propagation},{})
(1 row) (1 row)

View File

@ -10,58 +10,60 @@ SET search_path TO 'with_basics';
CREATE TABLE users_table (user_id int, time timestamp, value_1 int, value_2 int, value_3 float, value_4 bigint); CREATE TABLE users_table (user_id int, time timestamp, value_1 int, value_2 int, value_3 float, value_4 bigint);
SELECT create_distributed_table('users_table', 'user_id'); SELECT create_distributed_table('users_table', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint); CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint);
SELECT create_distributed_table('events_table', 'user_id'); SELECT create_distributed_table('events_table', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
\COPY users_table FROM '@abs_srcdir@/data/users_table.data' WITH CSV; \set users_table_data_file :abs_srcdir '/data/users_table.data'
\COPY events_table FROM '@abs_srcdir@/data/events_table.data' WITH CSV; \set events_table_data_file :abs_srcdir '/data/events_table.data'
COPY users_table FROM :'users_table_data_file' WITH CSV;
COPY events_table FROM :'events_table_data_file' WITH CSV;
SET citus.shard_count = 96; SET citus.shard_count = 96;
CREATE SCHEMA subquery_and_ctes; CREATE SCHEMA subquery_and_ctes;
SET search_path TO subquery_and_ctes; SET search_path TO subquery_and_ctes;
CREATE TABLE users_table (user_id int, time timestamp, value_1 int, value_2 int, value_3 float, value_4 bigint); CREATE TABLE users_table (user_id int, time timestamp, value_1 int, value_2 int, value_3 float, value_4 bigint);
SELECT create_distributed_table('users_table', 'user_id'); SELECT create_distributed_table('users_table', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint); CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint);
SELECT create_distributed_table('events_table', 'user_id'); SELECT create_distributed_table('events_table', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
\COPY users_table FROM '@abs_srcdir@/data/users_table.data' WITH CSV; COPY users_table FROM :'users_table_data_file' WITH CSV;
\COPY events_table FROM '@abs_srcdir@/data/events_table.data' WITH CSV; COPY events_table FROM :'events_table_data_file' WITH CSV;
SET citus.shard_count TO DEFAULT; SET citus.shard_count TO DEFAULT;
SET search_path TO DEFAULT; SET search_path TO DEFAULT;
CREATE TABLE users_table (user_id int, time timestamp, value_1 int, value_2 int, value_3 float, value_4 bigint); CREATE TABLE users_table (user_id int, time timestamp, value_1 int, value_2 int, value_3 float, value_4 bigint);
SELECT create_distributed_table('users_table', 'user_id'); SELECT create_distributed_table('users_table', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint); CREATE TABLE events_table (user_id int, time timestamp, event_type int, value_2 int, value_3 float, value_4 bigint);
SELECT create_distributed_table('events_table', 'user_id'); SELECT create_distributed_table('events_table', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
CREATE TABLE agg_results (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp); CREATE TABLE agg_results (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp);
SELECT create_distributed_table('agg_results', 'user_id'); SELECT create_distributed_table('agg_results', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -69,7 +71,7 @@ SELECT create_distributed_table('agg_results', 'user_id');
CREATE TABLE agg_results_second (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp); CREATE TABLE agg_results_second (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp);
SELECT create_distributed_table('agg_results_second', 'user_id'); SELECT create_distributed_table('agg_results_second', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -77,7 +79,7 @@ SELECT create_distributed_table('agg_results_second', 'user_id');
CREATE TABLE agg_results_third (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp); CREATE TABLE agg_results_third (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp);
SELECT create_distributed_table('agg_results_third', 'user_id'); SELECT create_distributed_table('agg_results_third', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -85,7 +87,7 @@ SELECT create_distributed_table('agg_results_third', 'user_id');
CREATE TABLE agg_results_fourth (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp); CREATE TABLE agg_results_fourth (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp);
SELECT create_distributed_table('agg_results_fourth', 'user_id'); SELECT create_distributed_table('agg_results_fourth', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -93,14 +95,14 @@ SELECT create_distributed_table('agg_results_fourth', 'user_id');
CREATE TABLE agg_results_window (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp); CREATE TABLE agg_results_window (user_id int, value_1_agg int, value_2_agg int, value_3_agg float, value_4_agg bigint, agg_time timestamp);
SELECT create_distributed_table('agg_results_window', 'user_id'); SELECT create_distributed_table('agg_results_window', 'user_id');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
CREATE TABLE users_ref_test_table(id int, it_name varchar(25), k_no int); CREATE TABLE users_ref_test_table(id int, it_name varchar(25), k_no int);
SELECT create_reference_table('users_ref_test_table'); SELECT create_reference_table('users_ref_test_table');
create_reference_table create_reference_table
------------------------ ---------------------------------------------------------------------
(1 row) (1 row)
@ -110,8 +112,8 @@ INSERT INTO users_ref_test_table VALUES(3,'User_3',47);
INSERT INTO users_ref_test_table VALUES(4,'User_4',48); INSERT INTO users_ref_test_table VALUES(4,'User_4',48);
INSERT INTO users_ref_test_table VALUES(5,'User_5',49); INSERT INTO users_ref_test_table VALUES(5,'User_5',49);
INSERT INTO users_ref_test_table VALUES(6,'User_6',50); INSERT INTO users_ref_test_table VALUES(6,'User_6',50);
\COPY users_table FROM '@abs_srcdir@/data/users_table.data' WITH CSV; COPY users_table FROM :'users_table_data_file' WITH CSV;
\COPY events_table FROM '@abs_srcdir@/data/events_table.data' WITH CSV; COPY events_table FROM :'events_table_data_file' WITH CSV;
-- create indexes for -- create indexes for
CREATE INDEX is_index1 ON users_table(user_id); CREATE INDEX is_index1 ON users_table(user_id);
CREATE INDEX is_index2 ON events_table(user_id); CREATE INDEX is_index2 ON events_table(user_id);
@ -136,7 +138,7 @@ SELECT run_command_on_master_and_workers($f$
RETURNS NULL ON NULL INPUT; RETURNS NULL ON NULL INPUT;
$f$); $f$);
run_command_on_master_and_workers run_command_on_master_and_workers
----------------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -144,7 +146,7 @@ SET citus.next_shard_id TO 1400297;
CREATE TABLE events_reference_table (like events_table including all); CREATE TABLE events_reference_table (like events_table including all);
SELECT create_reference_table('events_reference_table'); SELECT create_reference_table('events_reference_table');
create_reference_table create_reference_table
------------------------ ---------------------------------------------------------------------
(1 row) (1 row)
@ -153,7 +155,7 @@ INSERT INTO events_reference_table SELECT * FROM events_table;
CREATE TABLE users_reference_table (like users_table including all); CREATE TABLE users_reference_table (like users_table including all);
SELECT create_reference_table('users_reference_table'); SELECT create_reference_table('users_reference_table');
create_reference_table create_reference_table
------------------------ ---------------------------------------------------------------------
(1 row) (1 row)

View File

@ -217,7 +217,7 @@ SELECT master_create_empty_shard('events') AS new_shard_id
\gset \gset
UPDATE pg_dist_shard SET shardminvalue = '(2,2000000001)', shardmaxvalue = '(2,4300000000)' UPDATE pg_dist_shard SET shardminvalue = '(2,2000000001)', shardmaxvalue = '(2,4300000000)'
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
\COPY events FROM STDIN WITH CSV COPY events FROM STDIN WITH CSV;
CREATE TABLE users ( CREATE TABLE users (
composite_id user_composite_type, composite_id user_composite_type,
lastseen bigint lastseen bigint
@ -247,7 +247,7 @@ SELECT master_create_empty_shard('users') AS new_shard_id
\gset \gset
UPDATE pg_dist_shard SET shardminvalue = '(2,2000000001)', shardmaxvalue = '(2,4300000000)' UPDATE pg_dist_shard SET shardminvalue = '(2,2000000001)', shardmaxvalue = '(2,4300000000)'
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
\COPY users FROM STDIN WITH CSV COPY users FROM STDIN WITH CSV;
-- Create tables for subquery tests -- Create tables for subquery tests
CREATE TABLE lineitem_subquery ( CREATE TABLE lineitem_subquery (
l_orderkey bigint not null, l_orderkey bigint not null,
@ -330,7 +330,11 @@ SELECT master_create_empty_shard('orders_subquery') AS new_shard_id
\gset \gset
UPDATE pg_dist_shard SET shardminvalue = 8997, shardmaxvalue = 14947 UPDATE pg_dist_shard SET shardminvalue = 8997, shardmaxvalue = 14947
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
\copy lineitem_subquery FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem_subquery FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' COPY lineitem_subquery FROM :'lineitem_1_data_file' with delimiter '|';
\copy orders_subquery FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
\copy orders_subquery FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' COPY lineitem_subquery FROM :'lineitem_2_data_file' with delimiter '|';
\set orders_1_data_file :abs_srcdir '/data/orders.1.data'
COPY orders_subquery FROM :'orders_1_data_file' with delimiter '|';
\set orders_2_data_file :abs_srcdir '/data/orders.2.data'
COPY orders_subquery FROM :'orders_2_data_file' with delimiter '|';

View File

@ -29,8 +29,10 @@ SELECT create_distributed_table('lineitem_hash', 'l_orderkey', 'hash');
(1 row) (1 row)
\copy lineitem_hash FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem_hash FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
COPY lineitem_hash FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem_hash FROM :'lineitem_2_data_file' with delimiter '|';
ANALYZE lineitem_hash; ANALYZE lineitem_hash;
-- count(distinct) is supported on top level query if there -- count(distinct) is supported on top level query if there
-- is a grouping on the partition key -- is a grouping on the partition key

View File

@ -1,6 +1,11 @@
-- --
-- MULTI_COPY -- MULTI_COPY
-- --
-- set file paths
\set customer1datafile :abs_srcdir '/data/customer.1.data'
\set customer2datafile :abs_srcdir '/data/customer.2.data'
\set customer3datafile :abs_srcdir '/data/customer.3.data'
\set lineitem1datafile :abs_srcdir '/data/lineitem.1.data'
ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 560000; ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 560000;
-- Create a new hash-partitioned table into which to COPY -- Create a new hash-partitioned table into which to COPY
CREATE TABLE customer_copy_hash ( CREATE TABLE customer_copy_hash (
@ -101,7 +106,7 @@ SELECT count(*) FROM customer_copy_hash WHERE c_custkey = 9;
(1 row) (1 row)
-- Test server-side copy from file -- Test server-side copy from file
COPY customer_copy_hash FROM '@abs_srcdir@/data/customer.2.data' WITH (DELIMITER '|'); COPY customer_copy_hash FROM :'customer2datafile' WITH (DELIMITER '|');
-- Confirm that data was copied -- Confirm that data was copied
SELECT count(*) FROM customer_copy_hash; SELECT count(*) FROM customer_copy_hash;
count count
@ -110,7 +115,11 @@ SELECT count(*) FROM customer_copy_hash;
(1 row) (1 row)
-- Test client-side copy from file -- Test client-side copy from file
\copy customer_copy_hash FROM '@abs_srcdir@/data/customer.3.data' WITH (DELIMITER '|'); -- \copy does not support variable interpolation. Hence we store and execute
-- the query in two steps for interpolation to kick in.
-- See https://stackoverflow.com/a/67642094/4576416 for details.
\set client_side_copy_command '\\copy customer_copy_hash FROM ' :'customer3datafile' ' WITH (DELIMITER '''|''');'
:client_side_copy_command
-- Confirm that data was copied -- Confirm that data was copied
SELECT count(*) FROM customer_copy_hash; SELECT count(*) FROM customer_copy_hash;
count count
@ -199,7 +208,7 @@ SELECT master_create_distributed_table('customer_copy_range', 'c_custkey', 'rang
(1 row) (1 row)
-- Test COPY into empty range-partitioned table -- Test COPY into empty range-partitioned table
COPY customer_copy_range FROM '@abs_srcdir@/data/customer.1.data' WITH (DELIMITER '|'); COPY customer_copy_range FROM :'customer1datafile' WITH (DELIMITER '|');
ERROR: could not find any shards into which to copy ERROR: could not find any shards into which to copy
DETAIL: No shards exist for distributed table "customer_copy_range". DETAIL: No shards exist for distributed table "customer_copy_range".
SELECT master_create_empty_shard('customer_copy_range') AS new_shard_id SELECT master_create_empty_shard('customer_copy_range') AS new_shard_id
@ -211,7 +220,7 @@ SELECT master_create_empty_shard('customer_copy_range') AS new_shard_id
UPDATE pg_dist_shard SET shardminvalue = 501, shardmaxvalue = 1000 UPDATE pg_dist_shard SET shardminvalue = 501, shardmaxvalue = 1000
WHERE shardid = :new_shard_id; WHERE shardid = :new_shard_id;
-- Test copy into range-partitioned table -- Test copy into range-partitioned table
COPY customer_copy_range FROM '@abs_srcdir@/data/customer.1.data' WITH (DELIMITER '|'); COPY customer_copy_range FROM :'customer1datafile' WITH (DELIMITER '|');
-- Check whether data went into the right shard (maybe) -- Check whether data went into the right shard (maybe)
SELECT min(c_custkey), max(c_custkey), avg(c_custkey), count(*) SELECT min(c_custkey), max(c_custkey), avg(c_custkey), count(*)
FROM customer_copy_range WHERE c_custkey <= 500; FROM customer_copy_range WHERE c_custkey <= 500;
@ -351,7 +360,7 @@ SELECT create_distributed_table('lineitem_copy_append', 'l_orderkey', 'append');
BEGIN; BEGIN;
SELECT master_create_empty_shard('lineitem_copy_append') AS shardid \gset SELECT master_create_empty_shard('lineitem_copy_append') AS shardid \gset
COPY lineitem_copy_append FROM '@abs_srcdir@/data/lineitem.1.data' with (delimiter '|', append_to_shard :shardid); COPY lineitem_copy_append FROM :'lineitem1datafile' with (delimiter '|', append_to_shard :shardid);
END; END;
SELECT count(*) FROM pg_dist_shard WHERE logicalrelid = 'lineitem_copy_append'::regclass; SELECT count(*) FROM pg_dist_shard WHERE logicalrelid = 'lineitem_copy_append'::regclass;
count count
@ -360,9 +369,9 @@ SELECT count(*) FROM pg_dist_shard WHERE logicalrelid = 'lineitem_copy_append'::
(1 row) (1 row)
-- trigger some errors on the append_to_shard option -- trigger some errors on the append_to_shard option
COPY lineitem_copy_append FROM '@abs_srcdir@/data/lineitem.1.data' with (delimiter '|', append_to_shard xxxxx); COPY lineitem_copy_append FROM :'lineitem1datafile' with (delimiter '|', append_to_shard xxxxx);
ERROR: could not find valid entry for shard xxxxx ERROR: could not find valid entry for shard xxxxx
COPY lineitem_copy_append FROM '@abs_srcdir@/data/lineitem.1.data' with (delimiter '|', append_to_shard xxxxx); COPY lineitem_copy_append FROM :'lineitem1datafile' with (delimiter '|', append_to_shard xxxxx);
ERROR: shard xxxxx does not belong to table lineitem_copy_append ERROR: shard xxxxx does not belong to table lineitem_copy_append
-- Test schema support on append partitioned tables -- Test schema support on append partitioned tables
CREATE SCHEMA append; CREATE SCHEMA append;
@ -384,8 +393,8 @@ SELECT create_distributed_table('append.customer_copy', 'c_custkey', 'append');
SELECT master_create_empty_shard('append.customer_copy') AS shardid1 \gset SELECT master_create_empty_shard('append.customer_copy') AS shardid1 \gset
SELECT master_create_empty_shard('append.customer_copy') AS shardid2 \gset SELECT master_create_empty_shard('append.customer_copy') AS shardid2 \gset
-- Test copy from the master node -- Test copy from the master node
COPY append.customer_copy FROM '@abs_srcdir@/data/customer.1.data' with (delimiter '|', append_to_shard :shardid1); COPY append.customer_copy FROM :'customer1datafile' with (delimiter '|', append_to_shard :shardid1);
COPY append.customer_copy FROM '@abs_srcdir@/data/customer.2.data' with (delimiter '|', append_to_shard :shardid2); COPY append.customer_copy FROM :'customer2datafile' with (delimiter '|', append_to_shard :shardid2);
-- Test the content of the table -- Test the content of the table
SELECT min(c_custkey), max(c_custkey), avg(c_acctbal), count(*) FROM append.customer_copy; SELECT min(c_custkey), max(c_custkey), avg(c_acctbal), count(*) FROM append.customer_copy;
min | max | avg | count min | max | avg | count

View File

@ -1,16 +1,24 @@
-- --
-- MULTI_LOAD_DATA -- MULTI_LOAD_DATA
-- --
\copy lineitem FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
\copy orders FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' COPY lineitem FROM :'lineitem_1_data_file' with delimiter '|';
\copy orders FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' COPY lineitem FROM :'lineitem_2_data_file' with delimiter '|';
\copy orders_reference FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\copy orders_reference FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' \set orders_2_data_file :abs_srcdir '/data/orders.2.data'
\copy customer FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' COPY orders FROM :'orders_1_data_file' with delimiter '|';
\copy customer_append FROM '@abs_srcdir@/data/customer.1.data' with (delimiter '|', append_to_shard 360006) COPY orders FROM :'orders_2_data_file' with delimiter '|';
\copy nation FROM '@abs_srcdir@/data/nation.data' with delimiter '|' COPY orders_reference FROM :'orders_1_data_file' with delimiter '|';
\copy part FROM '@abs_srcdir@/data/part.data' with delimiter '|' COPY orders_reference FROM :'orders_2_data_file' with delimiter '|';
\copy part_append FROM '@abs_srcdir@/data/part.data' with (delimiter '|', append_to_shard 360009) \set customer_1_data_file :abs_srcdir '/data/customer.1.data'
\copy supplier FROM '@abs_srcdir@/data/supplier.data' with delimiter '|' \set nation_data_file :abs_srcdir '/data/nation.data'
\copy supplier_single_shard FROM '@abs_srcdir@/data/supplier.data' with delimiter '|' \set part_data_file :abs_srcdir '/data/part.data'
\set supplier_data_file :abs_srcdir '/data/supplier.data'
COPY customer FROM :'customer_1_data_file' with delimiter '|';
COPY customer_append FROM :'customer_1_data_file' with (delimiter '|', append_to_shard xxxxx);
COPY nation FROM :'nation_data_file' with delimiter '|';
COPY part FROM :'part_data_file' with delimiter '|';
COPY part_append FROM :'part_data_file' with (delimiter '|', append_to_shard xxxxx);
COPY supplier FROM :'supplier_data_file' with delimiter '|';
COPY supplier_single_shard FROM :'supplier_data_file' with delimiter '|';

View File

@ -1,4 +1,8 @@
\copy lineitem_hash_part FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\copy lineitem_hash_part FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
\copy orders_hash_part FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\copy orders_hash_part FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' \set orders_2_data_file :abs_srcdir '/data/orders.2.data'
COPY lineitem_hash_part FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem_hash_part FROM :'lineitem_2_data_file' with delimiter '|';
COPY orders_hash_part FROM :'orders_1_data_file' with delimiter '|';
COPY orders_hash_part FROM :'orders_2_data_file' with delimiter '|';

View File

@ -5,12 +5,15 @@ SET citus.next_shard_id TO 280000;
-- We load more data to customer and part tables to test distributed joins. The -- We load more data to customer and part tables to test distributed joins. The
-- loading causes the planner to consider customer and part tables as large, and -- loading causes the planner to consider customer and part tables as large, and
-- evaluate plans where some of the underlying tables need to be repartitioned. -- evaluate plans where some of the underlying tables need to be repartitioned.
\copy customer FROM '@abs_srcdir@/data/customer.2.data' with delimiter '|' \set customer_2_data_file :abs_srcdir '/data/customer.2.data'
\copy customer FROM '@abs_srcdir@/data/customer.3.data' with delimiter '|' \set customer_3_data_file :abs_srcdir '/data/customer.3.data'
\copy part FROM '@abs_srcdir@/data/part.more.data' with delimiter '|' \set part_more_data_file :abs_srcdir '/data/part.more.data'
COPY customer FROM :'customer_2_data_file' with delimiter '|';
COPY customer FROM :'customer_3_data_file' with delimiter '|';
COPY part FROM :'part_more_data_file' with delimiter '|';
SELECT master_create_empty_shard('customer_append') AS shardid1 \gset SELECT master_create_empty_shard('customer_append') AS shardid1 \gset
SELECT master_create_empty_shard('customer_append') AS shardid2 \gset SELECT master_create_empty_shard('customer_append') AS shardid2 \gset
copy customer_append FROM '@abs_srcdir@/data/customer.2.data' with (delimiter '|', append_to_shard :shardid1); copy customer_append FROM :'customer_2_data_file' with (delimiter '|', append_to_shard :shardid1);
copy customer_append FROM '@abs_srcdir@/data/customer.3.data' with (delimiter '|', append_to_shard :shardid2); copy customer_append FROM :'customer_3_data_file' with (delimiter '|', append_to_shard :shardid2);
SELECT master_create_empty_shard('part_append') AS shardid \gset SELECT master_create_empty_shard('part_append') AS shardid \gset
copy part_append FROM '@abs_srcdir@/data/part.more.data' with (delimiter '|', append_to_shard :shardid); copy part_append FROM :'part_more_data_file' with (delimiter '|', append_to_shard :shardid);

View File

@ -8,25 +8,43 @@
-- tests expect the placements to be in that order. -- tests expect the placements to be in that order.
SET citusdb.shard_placement_policy TO 'local-node-first'; SET citusdb.shard_placement_policy TO 'local-node-first';
-- load as superuser -- load as superuser
\copy lineitem FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\set copy_command '\\COPY lineitem FROM ' :'lineitem_1_data_file' ' with delimiter '''|''';'
:copy_command
-- as user with ALL access -- as user with ALL access
SET ROLE full_access; SET ROLE full_access;
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
\set copy_command '\\COPY lineitem FROM ' :'lineitem_2_data_file' ' with delimiter '''|''';'
:copy_command
RESET ROLE; RESET ROLE;
-- as user with SELECT access, should fail -- as user with SELECT access, should fail
SET ROLE read_access; SET ROLE read_access;
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set copy_command '\\COPY lineitem FROM ' :'lineitem_2_data_file' ' with delimiter '''|''';'
:copy_command
ERROR: permission denied for table lineitem ERROR: permission denied for table lineitem
RESET ROLE; RESET ROLE;
-- as user with no access, should fail -- as user with no access, should fail
SET ROLE no_access; SET ROLE no_access;
\copy lineitem FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set copy_command '\\COPY lineitem FROM ' :'lineitem_2_data_file' ' with delimiter '''|''';'
:copy_command
ERROR: permission denied for table lineitem ERROR: permission denied for table lineitem
RESET ROLE; RESET ROLE;
SET ROLE full_access; SET ROLE full_access;
\copy orders FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\copy orders FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' \set orders_2_data_file :abs_srcdir '/data/orders.2.data'
\copy customer FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' \set copy_command '\\COPY orders FROM ' :'orders_1_data_file' ' with delimiter '''|''';'
\copy nation FROM '@abs_srcdir@/data/nation.data' with delimiter '|' :copy_command
\copy part FROM '@abs_srcdir@/data/part.data' with delimiter '|' \set copy_command '\\COPY orders FROM ' :'orders_2_data_file' ' with delimiter '''|''';'
\copy supplier FROM '@abs_srcdir@/data/supplier.data' with delimiter '|' :copy_command
\set customer_1_data_file :abs_srcdir '/data/customer.1.data'
\set nation_data_file :abs_srcdir '/data/nation.data'
\set part_data_file :abs_srcdir '/data/part.data'
\set supplier_data_file :abs_srcdir '/data/supplier.data'
\set copy_command '\\COPY customer FROM ' :'customer_1_data_file' ' with delimiter '''|''';'
:copy_command
\set copy_command '\\COPY nation FROM ' :'nation_data_file' ' with delimiter '''|''';'
:copy_command
\set copy_command '\\COPY part FROM ' :'part_data_file' ' with delimiter '''|''';'
:copy_command
\set copy_command '\\COPY supplier FROM ' :'supplier_data_file' ' with delimiter '''|''';'
:copy_command

View File

@ -1,12 +1,13 @@
-- --
-- MULTI_MX_COPY_DATA -- MULTI_MX_COPY_DATA
-- --
\COPY nation_hash FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; \set nation_data_file :abs_srcdir '/data/nation.data'
COPY nation_hash FROM :'nation_data_file' with delimiter '|';
SET search_path TO citus_mx_test_schema; SET search_path TO citus_mx_test_schema;
\COPY nation_hash FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY nation_hash FROM :'nation_data_file' with delimiter '|';
\COPY citus_mx_test_schema_join_1.nation_hash FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY citus_mx_test_schema_join_1.nation_hash FROM :'nation_data_file' with delimiter '|';
\COPY citus_mx_test_schema_join_1.nation_hash_2 FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY citus_mx_test_schema_join_1.nation_hash_2 FROM :'nation_data_file' with delimiter '|';
\COPY citus_mx_test_schema_join_2.nation_hash FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY citus_mx_test_schema_join_2.nation_hash FROM :'nation_data_file' with delimiter '|';
SET citus.shard_replication_factor TO 2; SET citus.shard_replication_factor TO 2;
CREATE TABLE citus_mx_test_schema.nation_hash_replicated AS SELECT * FROM citus_mx_test_schema.nation_hash; CREATE TABLE citus_mx_test_schema.nation_hash_replicated AS SELECT * FROM citus_mx_test_schema.nation_hash;
SELECT create_distributed_table('citus_mx_test_schema.nation_hash_replicated', 'n_nationkey'); SELECT create_distributed_table('citus_mx_test_schema.nation_hash_replicated', 'n_nationkey');
@ -19,18 +20,24 @@ HINT: To remove the local data, run: SELECT truncate_local_data_after_distribut
(1 row) (1 row)
\COPY nation_hash_replicated FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY nation_hash_replicated FROM :'nation_data_file' with delimiter '|';
-- now try loading data from worker node -- now try loading data from worker node
\c - - - :worker_1_port \c - - - :worker_1_port
SET search_path TO public; SET search_path TO public;
\COPY lineitem_mx FROM '@abs_srcdir@/data/lineitem.1.data' with delimiter '|' \set lineitem_1_data_file :abs_srcdir '/data/lineitem.1.data'
\COPY lineitem_mx FROM '@abs_srcdir@/data/lineitem.2.data' with delimiter '|' \set lineitem_2_data_file :abs_srcdir '/data/lineitem.2.data'
\COPY citus_mx_test_schema.nation_hash_replicated FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; COPY lineitem_mx FROM :'lineitem_1_data_file' with delimiter '|';
COPY lineitem_mx FROM :'lineitem_2_data_file' with delimiter '|';
\set nation_data_file :abs_srcdir '/data/nation.data'
COPY citus_mx_test_schema.nation_hash_replicated FROM :'nation_data_file' with delimiter '|';
\c - - - :worker_2_port \c - - - :worker_2_port
-- and use second worker as well -- and use second worker as well
\COPY orders_mx FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\COPY orders_mx FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' \set orders_2_data_file :abs_srcdir '/data/orders.2.data'
\COPY citus_mx_test_schema.nation_hash_replicated FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; \set nation_data_file :abs_srcdir '/data/nation.data'
COPY orders_mx FROM :'orders_1_data_file' with delimiter '|';
COPY orders_mx FROM :'orders_2_data_file' with delimiter '|';
COPY citus_mx_test_schema.nation_hash_replicated FROM :'nation_data_file' with delimiter '|';
-- get ready for the next test -- get ready for the next test
TRUNCATE orders_mx; TRUNCATE orders_mx;
\c - - - :worker_2_port \c - - - :worker_2_port
@ -55,7 +62,9 @@ show citus.local_shared_pool_size;
-1 -1
(1 row) (1 row)
\COPY orders_mx FROM '@abs_srcdir@/data/orders.1.data' with delimiter '|' \set orders_1_data_file :abs_srcdir '/data/orders.1.data'
\set orders_2_data_file :abs_srcdir '/data/orders.2.data'
COPY orders_mx FROM :'orders_1_data_file' with delimiter '|';
NOTICE: executing the copy locally for shard xxxxx NOTICE: executing the copy locally for shard xxxxx
CONTEXT: COPY orders_mx, line 3: "3|1234|F|205654.30|1993-10-14|5-LOW|Clerk#000000955|0|sly final accounts boost. carefully regular id..." CONTEXT: COPY orders_mx, line 3: "3|1234|F|205654.30|1993-10-14|5-LOW|Clerk#000000955|0|sly final accounts boost. carefully regular id..."
NOTICE: executing the copy locally for shard xxxxx NOTICE: executing the copy locally for shard xxxxx
@ -72,7 +81,7 @@ NOTICE: executing the copy locally for shard xxxxx
CONTEXT: COPY orders_mx, line 25: "97|211|F|100572.55|1993-01-29|3-MEDIUM|Clerk#000000547|0|hang blithely along the regular accounts. f..." CONTEXT: COPY orders_mx, line 25: "97|211|F|100572.55|1993-01-29|3-MEDIUM|Clerk#000000547|0|hang blithely along the regular accounts. f..."
NOTICE: executing the copy locally for shard xxxxx NOTICE: executing the copy locally for shard xxxxx
CONTEXT: COPY orders_mx, line 38: "134|62|F|208201.46|1992-05-01|4-NOT SPECIFIED|Clerk#000000711|0|lar theodolites boos" CONTEXT: COPY orders_mx, line 38: "134|62|F|208201.46|1992-05-01|4-NOT SPECIFIED|Clerk#000000711|0|lar theodolites boos"
\COPY orders_mx FROM '@abs_srcdir@/data/orders.2.data' with delimiter '|' COPY orders_mx FROM :'orders_2_data_file' with delimiter '|';
NOTICE: executing the copy locally for shard xxxxx NOTICE: executing the copy locally for shard xxxxx
CONTEXT: COPY orders_mx, line 2: "8998|80|F|147264.16|1993-01-04|5-LOW|Clerk#000000733|0| fluffily pending sauternes cajo" CONTEXT: COPY orders_mx, line 2: "8998|80|F|147264.16|1993-01-04|5-LOW|Clerk#000000733|0| fluffily pending sauternes cajo"
NOTICE: executing the copy locally for shard xxxxx NOTICE: executing the copy locally for shard xxxxx
@ -89,7 +98,8 @@ NOTICE: executing the copy locally for shard xxxxx
CONTEXT: COPY orders_mx, line 43: "9159|1135|O|99594.61|1995-07-26|1-URGENT|Clerk#000000892|0|xcuses. quickly ironic deposits wake alon..." CONTEXT: COPY orders_mx, line 43: "9159|1135|O|99594.61|1995-07-26|1-URGENT|Clerk#000000892|0|xcuses. quickly ironic deposits wake alon..."
NOTICE: executing the copy locally for shard xxxxx NOTICE: executing the copy locally for shard xxxxx
CONTEXT: COPY orders_mx, line 69: "9281|904|F|173278.28|1992-02-24|1-URGENT|Clerk#000000530|0|eep furiously according to the requests; ..." CONTEXT: COPY orders_mx, line 69: "9281|904|F|173278.28|1992-02-24|1-URGENT|Clerk#000000530|0|eep furiously according to the requests; ..."
\COPY citus_mx_test_schema.nation_hash_replicated FROM '@abs_srcdir@/data/nation.data' with delimiter '|'; \set nation_data_file :abs_srcdir '/data/nation.data'
COPY citus_mx_test_schema.nation_hash_replicated FROM :'nation_data_file' with delimiter '|';
NOTICE: executing the copy locally for shard xxxxx NOTICE: executing the copy locally for shard xxxxx
CONTEXT: COPY nation_hash_replicated, line 1: "0|ALGERIA|0| haggle. carefully final deposits detect slyly agai" CONTEXT: COPY nation_hash_replicated, line 1: "0|ALGERIA|0| haggle. carefully final deposits detect slyly agai"
NOTICE: executing the copy locally for shard xxxxx NOTICE: executing the copy locally for shard xxxxx
@ -124,7 +134,11 @@ show citus.local_shared_pool_size;
-- when worker nodes gain capability to run dml commands on reference tables. -- when worker nodes gain capability to run dml commands on reference tables.
\c - - - :master_port \c - - - :master_port
SET search_path TO public; SET search_path TO public;
\COPY customer_mx FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' \set customer_1_data_file :abs_srcdir '/data/customer.1.data'
\COPY nation_mx FROM '@abs_srcdir@/data/nation.data' with delimiter '|' \set nation_data_file :abs_srcdir '/data/nation.data'
\COPY part_mx FROM '@abs_srcdir@/data/part.data' with delimiter '|' \set part_data_file :abs_srcdir '/data/part.data'
\COPY supplier_mx FROM '@abs_srcdir@/data/supplier.data' with delimiter '|' \set supplier_data_file :abs_srcdir '/data/supplier.data'
COPY customer_mx FROM :'customer_1_data_file' with delimiter '|';
COPY nation_mx FROM :'nation_data_file' with delimiter '|';
COPY part_mx FROM :'part_data_file' with delimiter '|';
COPY supplier_mx FROM :'supplier_data_file' with delimiter '|';

View File

@ -86,10 +86,13 @@ SELECT create_reference_table('multi_outer_join_third_reference');
(1 row) (1 row)
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-1-10.data' with delimiter '|' \set customer_1_10_data :abs_srcdir '/data/customer-1-10.data'
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' \set customer_11_20_data :abs_srcdir '/data/customer-11-20.data'
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' \set customer_1_15_data :abs_srcdir '/data/customer-1-15.data'
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' COPY multi_outer_join_left FROM :'customer_1_10_data' with delimiter '|';
COPY multi_outer_join_left FROM :'customer_11_20_data' with delimiter '|';
COPY multi_outer_join_right FROM :'customer_1_15_data' with delimiter '|';
COPY multi_outer_join_right_reference FROM :'customer_1_15_data' with delimiter '|';
-- Make sure we do not crash if one table has no shards -- Make sure we do not crash if one table has no shards
SELECT SELECT
min(l_custkey), max(l_custkey) min(l_custkey), max(l_custkey)
@ -110,8 +113,9 @@ FROM
(1 row) (1 row)
-- Third table is a single shard table with all data -- Third table is a single shard table with all data
\copy multi_outer_join_third FROM '@abs_srcdir@/data/customer-1-30.data' with delimiter '|' \set customer_1_30_data :abs_srcdir '/data/customer-1-30.data'
\copy multi_outer_join_third_reference FROM '@abs_srcdir@/data/customer-1-30.data' with delimiter '|' COPY multi_outer_join_third FROM :'customer_1_30_data' with delimiter '|';
COPY multi_outer_join_third_reference FROM :'customer_1_30_data' with delimiter '|';
-- Regular outer join should return results for all rows -- Regular outer join should return results for all rows
SELECT SELECT
min(l_custkey), max(l_custkey) min(l_custkey), max(l_custkey)
@ -223,7 +227,8 @@ FROM
(1 row) (1 row)
-- Turn the right table into a large table -- Turn the right table into a large table
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' \set customer_21_30_data :abs_srcdir '/data/customer-21-30.data'
COPY multi_outer_join_right FROM :'customer_21_30_data' with delimiter '|';
-- Shards do not have 1-1 matching. We should error here. -- Shards do not have 1-1 matching. We should error here.
SELECT SELECT
min(l_custkey), max(l_custkey) min(l_custkey), max(l_custkey)
@ -238,10 +243,12 @@ FROM
TRUNCATE multi_outer_join_left; TRUNCATE multi_outer_join_left;
TRUNCATE multi_outer_join_right; TRUNCATE multi_outer_join_right;
-- reload shards with 1-1 matching -- reload shards with 1-1 matching
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-subset-11-20.data' with delimiter '|' \set customer_subset_11_20_data :abs_srcdir '/data/customer-subset-11-20.data'
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' COPY multi_outer_join_left FROM :'customer_subset_11_20_data' with delimiter '|';
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' COPY multi_outer_join_left FROM :'customer_21_30_data' with delimiter '|';
\copy multi_outer_join_right FROM '@abs_srcdir@/data/customer-subset-21-30.data' with delimiter '|' \set customer_subset_21_30_data :abs_srcdir '/data/customer-subset-21-30.data'
COPY multi_outer_join_right FROM :'customer_11_20_data' with delimiter '|';
COPY multi_outer_join_right FROM :'customer_subset_21_30_data' with delimiter '|';
-- multi_outer_join_third is a single shard table -- multi_outer_join_third is a single shard table
-- Regular left join should work as expected -- Regular left join should work as expected
SELECT SELECT
@ -795,7 +802,8 @@ LIMIT 20;
(16 rows) (16 rows)
-- Add a shard to the left table that overlaps with multiple shards in the right -- Add a shard to the left table that overlaps with multiple shards in the right
\copy multi_outer_join_left FROM '@abs_srcdir@/data/customer.1.data' with delimiter '|' \set customer_1_data_file :abs_srcdir '/data/customer.1.data'
COPY multi_outer_join_left FROM :'customer_1_data_file' with delimiter '|';
-- All outer joins should error out -- All outer joins should error out
SELECT SELECT
min(l_custkey), max(l_custkey) min(l_custkey), max(l_custkey)
@ -877,7 +885,7 @@ SELECT create_distributed_table('left_values', 'val');
(1 row) (1 row)
\copy left_values from stdin COPY left_values from stdin;
CREATE TABLE right_values(val int); CREATE TABLE right_values(val int);
SELECT create_distributed_table('right_values', 'val'); SELECT create_distributed_table('right_values', 'val');
create_distributed_table create_distributed_table
@ -885,7 +893,7 @@ SELECT create_distributed_table('right_values', 'val');
(1 row) (1 row)
\copy right_values from stdin COPY right_values from stdin;
SELECT SELECT
* *
FROM FROM

View File

@ -15,7 +15,7 @@ CREATE TABLE multi_outer_join_left_hash
); );
SELECT create_distributed_table('multi_outer_join_left_hash', 'l_custkey'); SELECT create_distributed_table('multi_outer_join_left_hash', 'l_custkey');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -32,7 +32,7 @@ CREATE TABLE multi_outer_join_right_reference
); );
SELECT create_reference_table('multi_outer_join_right_reference'); SELECT create_reference_table('multi_outer_join_right_reference');
create_reference_table create_reference_table
------------------------ ---------------------------------------------------------------------
(1 row) (1 row)
@ -49,7 +49,7 @@ CREATE TABLE multi_outer_join_third_reference
); );
SELECT create_reference_table('multi_outer_join_third_reference'); SELECT create_reference_table('multi_outer_join_third_reference');
create_reference_table create_reference_table
------------------------ ---------------------------------------------------------------------
(1 row) (1 row)
@ -66,7 +66,7 @@ CREATE TABLE multi_outer_join_right_hash
); );
SELECT create_distributed_table('multi_outer_join_right_hash', 'r_custkey'); SELECT create_distributed_table('multi_outer_join_right_hash', 'r_custkey');
create_distributed_table create_distributed_table
-------------------------- ---------------------------------------------------------------------
(1 row) (1 row)
@ -76,23 +76,26 @@ SELECT
FROM FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_third_reference b ON (l_custkey = t_custkey); multi_outer_join_left_hash a LEFT JOIN multi_outer_join_third_reference b ON (l_custkey = t_custkey);
min | max min | max
-----+----- ---------------------------------------------------------------------
| |
(1 row) (1 row)
-- Left table is a large table -- Left table is a large table
\copy multi_outer_join_left_hash FROM '@abs_srcdir@/data/customer-1-10.data' with delimiter '|' \set customer_1_10_data :abs_srcdir '/data/customer-1-10.data'
\copy multi_outer_join_left_hash FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' \set customer_11_20_data :abs_srcdir '/data/customer-11-20.data'
COPY multi_outer_join_left_hash FROM :'customer_1_10_data' with delimiter '|';
COPY multi_outer_join_left_hash FROM :'customer_11_20_data' with delimiter '|';
-- Right table is a small table -- Right table is a small table
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' \set customer_1_15_data :abs_srcdir '/data/customer-1-15.data'
\copy multi_outer_join_right_hash FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' COPY multi_outer_join_right_reference FROM :'customer_1_15_data' with delimiter '|';
COPY multi_outer_join_right_hash FROM :'customer_1_15_data' with delimiter '|';
-- Make sure we do not crash if one table has data -- Make sure we do not crash if one table has data
SELECT SELECT
min(l_custkey), max(l_custkey) min(l_custkey), max(l_custkey)
FROM FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_third_reference b ON (l_custkey = t_custkey); multi_outer_join_left_hash a LEFT JOIN multi_outer_join_third_reference b ON (l_custkey = t_custkey);
min | max min | max
-----+----- ---------------------------------------------------------------------
1 | 20 1 | 20
(1 row) (1 row)
@ -101,20 +104,21 @@ SELECT
FROM FROM
multi_outer_join_third_reference a LEFT JOIN multi_outer_join_right_reference b ON (r_custkey = t_custkey); multi_outer_join_third_reference a LEFT JOIN multi_outer_join_right_reference b ON (r_custkey = t_custkey);
min | max min | max
-----+----- ---------------------------------------------------------------------
| |
(1 row) (1 row)
-- Third table is a single shard table with all data -- Third table is a single shard table with all data
\copy multi_outer_join_third_reference FROM '@abs_srcdir@/data/customer-1-30.data' with delimiter '|' \set customer_1_30_data :abs_srcdir '/data/customer-1-30.data'
\copy multi_outer_join_right_hash FROM '@abs_srcdir@/data/customer-1-30.data' with delimiter '|' COPY multi_outer_join_third_reference FROM :'customer_1_30_data' with delimiter '|';
COPY multi_outer_join_right_hash FROM :'customer_1_30_data' with delimiter '|';
-- Regular outer join should return results for all rows -- Regular outer join should return results for all rows
SELECT SELECT
min(l_custkey), max(l_custkey) min(l_custkey), max(l_custkey)
FROM FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b ON (l_custkey = r_custkey); multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b ON (l_custkey = r_custkey);
min | max min | max
-----+----- ---------------------------------------------------------------------
1 | 20 1 | 20
(1 row) (1 row)
@ -124,7 +128,7 @@ SELECT
FROM FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b ON (l_nationkey = r_nationkey); multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b ON (l_nationkey = r_nationkey);
count count
------- ---------------------------------------------------------------------
28 28
(1 row) (1 row)
@ -136,7 +140,7 @@ FROM
WHERE WHERE
r_custkey IS NULL; r_custkey IS NULL;
min | max min | max
-----+----- ---------------------------------------------------------------------
16 | 20 16 | 20
(1 row) (1 row)
@ -148,7 +152,7 @@ FROM
WHERE WHERE
r_custkey IS NULL OR r_custkey = 5; r_custkey IS NULL OR r_custkey = 5;
min | max min | max
-----+----- ---------------------------------------------------------------------
5 | 20 5 | 20
(1 row) (1 row)
@ -161,7 +165,7 @@ FROM
WHERE WHERE
r_custkey = 5 or r_custkey > 15; r_custkey = 5 or r_custkey > 15;
min | max min | max
-----+----- ---------------------------------------------------------------------
5 | 5 5 | 5
(1 row) (1 row)
@ -172,7 +176,7 @@ FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b
ON (l_custkey = r_custkey AND r_custkey = 5); ON (l_custkey = r_custkey AND r_custkey = 5);
count | count count | count
-------+------- ---------------------------------------------------------------------
20 | 1 20 | 1
(1 row) (1 row)
@ -183,7 +187,7 @@ FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b
ON (l_custkey = r_custkey AND r_custkey = -1 /* nonexistant */); ON (l_custkey = r_custkey AND r_custkey = -1 /* nonexistant */);
count | count count | count
-------+------- ---------------------------------------------------------------------
20 | 0 20 | 0
(1 row) (1 row)
@ -194,7 +198,7 @@ FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b
ON (l_custkey = r_custkey AND l_custkey = -1 /* nonexistant */); ON (l_custkey = r_custkey AND l_custkey = -1 /* nonexistant */);
count | count count | count
-------+------- ---------------------------------------------------------------------
20 | 0 20 | 0
(1 row) (1 row)
@ -211,12 +215,13 @@ SELECT
FROM FROM
multi_outer_join_right_reference a RIGHT JOIN multi_outer_join_left_hash b ON (l_custkey = r_custkey); multi_outer_join_right_reference a RIGHT JOIN multi_outer_join_left_hash b ON (l_custkey = r_custkey);
min | max min | max
-----+----- ---------------------------------------------------------------------
1 | 20 1 | 20
(1 row) (1 row)
-- load some more data -- load some more data
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' \set customer_21_30_data :abs_srcdir '/data/customer-21-30.data'
COPY multi_outer_join_right_reference FROM :'customer_21_30_data' with delimiter '|';
-- Update shards so that they do not have 1-1 matching, triggering an error. -- Update shards so that they do not have 1-1 matching, triggering an error.
UPDATE pg_dist_shard SET shardminvalue = '2147483646' WHERE shardid = 1260006; UPDATE pg_dist_shard SET shardminvalue = '2147483646' WHERE shardid = 1260006;
UPDATE pg_dist_shard SET shardmaxvalue = '2147483647' WHERE shardid = 1260006; UPDATE pg_dist_shard SET shardmaxvalue = '2147483647' WHERE shardid = 1260006;
@ -230,12 +235,12 @@ UPDATE pg_dist_shard SET shardmaxvalue = '-1073741825' WHERE shardid = 1260006;
-- empty tables -- empty tables
TRUNCATE multi_outer_join_left_hash, multi_outer_join_right_hash, multi_outer_join_right_reference; TRUNCATE multi_outer_join_left_hash, multi_outer_join_right_hash, multi_outer_join_right_reference;
-- reload shards with 1-1 matching -- reload shards with 1-1 matching
\copy multi_outer_join_left_hash FROM '@abs_srcdir@/data/customer-1-15.data' with delimiter '|' COPY multi_outer_join_left_hash FROM :'customer_1_15_data' with delimiter '|';
\copy multi_outer_join_left_hash FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' COPY multi_outer_join_left_hash FROM :'customer_21_30_data' with delimiter '|';
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' COPY multi_outer_join_right_reference FROM :'customer_11_20_data' with delimiter '|';
\copy multi_outer_join_right_reference FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' COPY multi_outer_join_right_reference FROM :'customer_21_30_data' with delimiter '|';
\copy multi_outer_join_right_hash FROM '@abs_srcdir@/data/customer-11-20.data' with delimiter '|' COPY multi_outer_join_right_hash FROM :'customer_11_20_data' with delimiter '|';
\copy multi_outer_join_right_hash FROM '@abs_srcdir@/data/customer-21-30.data' with delimiter '|' COPY multi_outer_join_right_hash FROM :'customer_21_30_data' with delimiter '|';
-- multi_outer_join_third_reference is a single shard table -- multi_outer_join_third_reference is a single shard table
-- Regular left join should work as expected -- Regular left join should work as expected
SELECT SELECT
@ -243,7 +248,7 @@ SELECT
FROM FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_hash b ON (l_custkey = r_custkey); multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_hash b ON (l_custkey = r_custkey);
min | max min | max
-----+----- ---------------------------------------------------------------------
1 | 30 1 | 30
(1 row) (1 row)
@ -261,7 +266,7 @@ FROM
WHERE WHERE
r_custkey IS NULL; r_custkey IS NULL;
min | max min | max
-----+----- ---------------------------------------------------------------------
1 | 10 1 | 10
(1 row) (1 row)
@ -273,7 +278,7 @@ FROM
WHERE WHERE
r_custkey IS NULL OR r_custkey = 15; r_custkey IS NULL OR r_custkey = 15;
min | max min | max
-----+----- ---------------------------------------------------------------------
1 | 15 1 | 15
(1 row) (1 row)
@ -286,7 +291,7 @@ FROM
WHERE WHERE
r_custkey = 21 or r_custkey < 10; r_custkey = 21 or r_custkey < 10;
min | max min | max
-----+----- ---------------------------------------------------------------------
21 | 21 21 | 21
(1 row) (1 row)
@ -297,7 +302,7 @@ FROM
multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b multi_outer_join_left_hash a LEFT JOIN multi_outer_join_right_reference b
ON (l_custkey = r_custkey AND r_custkey = 21); ON (l_custkey = r_custkey AND r_custkey = 21);
count | count count | count
-------+------- ---------------------------------------------------------------------
25 | 1 25 | 1
(1 row) (1 row)
@ -314,7 +319,7 @@ SELECT
FROM FROM
multi_outer_join_right_reference a RIGHT JOIN multi_outer_join_left_hash b ON (l_custkey = r_custkey); multi_outer_join_right_reference a RIGHT JOIN multi_outer_join_left_hash b ON (l_custkey = r_custkey);
min | max min | max
-----+----- ---------------------------------------------------------------------
1 | 30 1 | 30
(1 row) (1 row)
@ -347,7 +352,7 @@ FROM
LEFT JOIN multi_outer_join_third_reference t1 ON (r1.r_custkey = t1.t_custkey) LEFT JOIN multi_outer_join_third_reference t1 ON (r1.r_custkey = t1.t_custkey)
ORDER BY 1; ORDER BY 1;
l_custkey | r_custkey | t_custkey l_custkey | r_custkey | t_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
1 | | 1 | |
2 | | 2 | |
3 | | 3 | |
@ -393,7 +398,7 @@ FROM
LEFT JOIN multi_outer_join_left_hash l1 ON (r1.r_custkey = l1.l_custkey) LEFT JOIN multi_outer_join_left_hash l1 ON (r1.r_custkey = l1.l_custkey)
ORDER BY 1,2,3; ORDER BY 1,2,3;
t_custkey | r_custkey | l_custkey t_custkey | r_custkey | l_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
11 | 11 | 11 11 | 11 | 11
12 | 12 | 12 12 | 12 | 12
13 | 13 | 13 13 | 13 | 13
@ -427,7 +432,7 @@ WHERE
l_custkey is NULL l_custkey is NULL
ORDER BY 1; ORDER BY 1;
t_custkey | r_custkey | l_custkey t_custkey | r_custkey | l_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
16 | 16 | 16 | 16 |
17 | 17 | 17 | 17 |
18 | 18 | 18 | 18 |
@ -444,7 +449,7 @@ FROM
RIGHT JOIN multi_outer_join_left_hash l1 ON (r1.r_custkey = l1.l_custkey) RIGHT JOIN multi_outer_join_left_hash l1 ON (r1.r_custkey = l1.l_custkey)
ORDER BY l_custkey; ORDER BY l_custkey;
t_custkey | r_custkey | l_custkey t_custkey | r_custkey | l_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
| | 1 | | 1
| | 2 | | 2
| | 3 | | 3
@ -480,7 +485,7 @@ FROM
FULL JOIN multi_outer_join_right_hash r1 ON (l1.l_custkey = r1.r_custkey) FULL JOIN multi_outer_join_right_hash r1 ON (l1.l_custkey = r1.r_custkey)
ORDER BY 1,2; ORDER BY 1,2;
l_custkey | r_custkey l_custkey | r_custkey
-----------+----------- ---------------------------------------------------------------------
1 | 1 |
2 | 2 |
3 | 3 |
@ -523,7 +528,7 @@ WHERE
r_custkey is NULL r_custkey is NULL
ORDER BY 1; ORDER BY 1;
l_custkey | r_custkey l_custkey | r_custkey
-----------+----------- ---------------------------------------------------------------------
1 | 1 |
2 | 2 |
3 | 3 |
@ -546,7 +551,7 @@ WHERE
l_custkey is NULL l_custkey is NULL
ORDER BY 2; ORDER BY 2;
l_custkey | r_custkey l_custkey | r_custkey
-----------+----------- ---------------------------------------------------------------------
| 16 | 16
| 17 | 17
| 18 | 18
@ -564,7 +569,7 @@ WHERE
l_custkey is NULL or r_custkey is NULL l_custkey is NULL or r_custkey is NULL
ORDER BY 1,2 DESC; ORDER BY 1,2 DESC;
l_custkey | r_custkey l_custkey | r_custkey
-----------+----------- ---------------------------------------------------------------------
1 | 1 |
2 | 2 |
3 | 3 |
@ -599,7 +604,7 @@ FROM
LEFT JOIN multi_outer_join_third_reference t1 ON (r1.r_custkey = t1.t_custkey) LEFT JOIN multi_outer_join_third_reference t1 ON (r1.r_custkey = t1.t_custkey)
ORDER BY 1; ORDER BY 1;
l_custkey | r_custkey | t_custkey l_custkey | r_custkey | t_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
11 | 11 | 11 11 | 11 | 11
12 | 12 | 12 12 | 12 | 12
13 | 13 | 13 13 | 13 | 13
@ -626,7 +631,7 @@ FROM
LEFT JOIN multi_outer_join_right_hash r1 ON (l1.l_custkey = r1.r_custkey) LEFT JOIN multi_outer_join_right_hash r1 ON (l1.l_custkey = r1.r_custkey)
ORDER BY 1,2,3; ORDER BY 1,2,3;
l_custkey | t_custkey | r_custkey l_custkey | t_custkey | r_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
1 | 1 | 1 | 1 |
2 | 2 | 2 | 2 |
3 | 3 | 3 | 3 |
@ -663,7 +668,7 @@ FROM
LEFT JOIN multi_outer_join_right_reference r1 ON (l1.l_custkey = r1.r_custkey) LEFT JOIN multi_outer_join_right_reference r1 ON (l1.l_custkey = r1.r_custkey)
ORDER BY 1,2,3; ORDER BY 1,2,3;
t_custkey | l_custkey | r_custkey t_custkey | l_custkey | r_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
1 | 1 | 1 | 1 |
2 | 2 | 2 | 2 |
3 | 3 | 3 | 3 |
@ -700,7 +705,7 @@ FROM
LEFT JOIN multi_outer_join_right_hash r1 ON (l1.l_custkey = r1.r_custkey) LEFT JOIN multi_outer_join_right_hash r1 ON (l1.l_custkey = r1.r_custkey)
ORDER BY 1,2,3; ORDER BY 1,2,3;
l_custkey | t_custkey | r_custkey l_custkey | t_custkey | r_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
1 | 1 | 1 | 1 |
2 | 2 | 2 | 2 |
3 | 3 | 3 | 3 |
@ -739,7 +744,7 @@ WHERE
r_custkey is NULL r_custkey is NULL
ORDER BY 1; ORDER BY 1;
l_custkey | t_custkey | r_custkey l_custkey | t_custkey | r_custkey
-----------+-----------+----------- ---------------------------------------------------------------------
1 | 1 | 1 | 1 |
2 | 2 | 2 | 2 |
3 | 3 | 3 | 3 |
@ -762,7 +767,7 @@ FROM
INNER JOIN multi_outer_join_third_reference t1 ON (test.c_custkey = t1.t_custkey) INNER JOIN multi_outer_join_third_reference t1 ON (test.c_custkey = t1.t_custkey)
ORDER BY 1; ORDER BY 1;
t_custkey t_custkey
----------- ---------------------------------------------------------------------
11 11
12 12
13 13
@ -803,7 +808,7 @@ GROUP BY l1.l_custkey
ORDER BY cnt DESC, l1.l_custkey DESC ORDER BY cnt DESC, l1.l_custkey DESC
LIMIT 20; LIMIT 20;
l_custkey | cnt l_custkey | cnt
-----------+----- ---------------------------------------------------------------------
30 | 1 30 | 1
29 | 1 29 | 1
28 | 1 28 | 1
@ -834,7 +839,7 @@ FROM
multi_outer_join_third_reference ON (t_custkey = r_custkey) multi_outer_join_third_reference ON (t_custkey = r_custkey)
ORDER BY 1; ORDER BY 1;
t_custkey | r_custkey t_custkey | r_custkey
-----------+----------- ---------------------------------------------------------------------
1 | 1 |
2 | 2 |
3 | 3 |
@ -880,7 +885,7 @@ LEFT JOIN (
) AS bar ) AS bar
ON (l_name = r_name); ON (l_name = r_name);
count count
------- ---------------------------------------------------------------------
25 25
(1 row) (1 row)

View File

@ -1,5 +1,8 @@
CREATE TABLESPACE test_tablespace LOCATION '@abs_srcdir@/tmp_check/ts0'; \set test_tablespace :abs_srcdir '/tmp_check/ts0'
CREATE TABLESPACE test_tablespace LOCATION XXXX
\c - - - :worker_1_port \c - - - :worker_1_port
CREATE TABLESPACE test_tablespace LOCATION '@abs_srcdir@/tmp_check/ts1'; \set test_tablespace :abs_srcdir '/tmp_check/ts1'
CREATE TABLESPACE test_tablespace LOCATION XXXX
\c - - - :worker_2_port \c - - - :worker_2_port
CREATE TABLESPACE test_tablespace LOCATION '@abs_srcdir@/tmp_check/ts2'; \set test_tablespace :abs_srcdir '/tmp_check/ts2'
CREATE TABLESPACE test_tablespace LOCATION XXXX