Merge pull request #2324 from citusdata/test/pg11-compatibility

make tests pass on pg 11 again

cr: @jasonmp85
pull/2341/head
Jason Petersen 2018-08-15 23:52:47 -06:00 committed by GitHub
commit 54789d6896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 1480 additions and 243 deletions

View File

@ -24,7 +24,7 @@ matrix:
allow_failures:
- env: PGVERSION=11
before_install:
- git clone -b v0.7.8 --depth 1 https://github.com/citusdata/tools.git
- git clone -b v0.7.9 --depth 1 https://github.com/citusdata/tools.git
- sudo make -C tools install
- setup_apt
- curl https://install.citusdata.com/community/deb.sh | sudo bash

View File

@ -15,12 +15,15 @@
#include "access/htup_details.h"
#include "catalog/namespace.h"
#include "catalog/pg_constraint.h"
#if (PG_VERSION_NUM < 110000)
#include "catalog/pg_constraint_fn.h"
#endif
#include "catalog/pg_type.h"
#include "distributed/colocation_utils.h"
#include "distributed/foreign_constraint.h"
#include "distributed/master_protocol.h"
#include "distributed/multi_join_order.h"
#include "distributed/version_compat.h"
#include "utils/fmgroids.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
@ -640,7 +643,7 @@ HeapTupleOfForeignConstraintIncludesColumn(HeapTuple heapTuple, Oid relationId,
{
AttrNumber attrNo = DatumGetInt16(columnArray[attrIdx]);
char *colName = get_relid_attribute_name(relationId, attrNo);
char *colName = get_attname_internal(relationId, attrNo, false);
if (strncmp(colName, columnName, NAMEDATALEN) == 0)
{
return true;

View File

@ -141,7 +141,7 @@ InitializeTransactionManagement(void)
AdjustMaxPreparedTransactions();
/* set aside 8kb of memory for use in CoordinatedTransactionCallback */
CommitContext = AllocSetContextCreate(TopMemoryContext,
CommitContext = AllocSetContextCreateExtended(TopMemoryContext,
"CommitContext",
8 * 1024,
8 * 1024,

View File

@ -3,6 +3,13 @@
-- there is foreign key relation between reference
-- tables and distributed tables
--
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten;
version_above_ten
-------------------
f
(1 row)
CREATE SCHEMA test_fkey_to_ref_in_tx;
SET search_path TO 'test_fkey_to_ref_in_tx';
SET citus.next_shard_id TO 2380000;

File diff suppressed because it is too large Load Diff

View File

@ -335,12 +335,12 @@ SELECT create_distributed_table('check_example', 'partition_col', 'hash');
(1 row)
\c - - - :worker_1_port
\d check_example_partition_col_key_365056
Index "public.check_example_partition_col_key_365056"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'check_example_partition_col_key_365056'::regclass;
Column | Type | Definition
---------------+---------+---------------
partition_col | integer | partition_col
unique, btree, for table "public.check_example_365056"
(1 row)
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.check_example_365056'::regclass;
Constraint | Definition

View File

@ -282,19 +282,19 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_sch
col_3 | bigint | not null default nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass)
(3 rows)
\d mx_testing_schema.mx_test_table_col_1_key
Index "mx_testing_schema.mx_test_table_col_1_key"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_testing_schema.mx_test_table_col_1_key'::regclass;
Column | Type | Definition
--------+---------+------------
col_1 | integer | col_1
unique, btree, for table "mx_testing_schema.mx_test_table"
(1 row)
\d mx_testing_schema.mx_index
Index "mx_testing_schema.mx_index"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_testing_schema.mx_index'::regclass;
Column | Type | Definition
--------+------+------------
col_2 | text | col_2
btree, for table "mx_testing_schema.mx_test_table"
(1 row)
-- Check that pg_dist_colocation is not synced
SELECT * FROM pg_dist_colocation ORDER BY colocationid;
@ -421,19 +421,19 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_sch
col_3 | bigint | not null default nextval('mx_testing_schema.mx_test_table_col_3_seq'::regclass)
(3 rows)
\d mx_testing_schema.mx_test_table_col_1_key
Index "mx_testing_schema.mx_test_table_col_1_key"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_testing_schema.mx_test_table_col_1_key'::regclass;
Column | Type | Definition
--------+---------+------------
col_1 | integer | col_1
unique, btree, for table "mx_testing_schema.mx_test_table"
(1 row)
\d mx_testing_schema.mx_index
Index "mx_testing_schema.mx_index"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_testing_schema.mx_index'::regclass;
Column | Type | Definition
--------+------+------------
col_2 | text | col_2
btree, for table "mx_testing_schema.mx_test_table"
(1 row)
SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table'::regclass;
count
@ -560,19 +560,19 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema
col2 | text |
(2 rows)
\d mx_test_schema_1.mx_table_1_col1_key
Index "mx_test_schema_1.mx_table_1_col1_key"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_1.mx_table_1_col1_key'::regclass;
Column | Type | Definition
--------+---------+------------
col1 | integer | col1
unique, btree, for table "mx_test_schema_1.mx_table_1"
(1 row)
\d mx_test_schema_1.mx_index_1
Index "mx_test_schema_1.mx_index_1"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_1.mx_index_1'::regclass;
Column | Type | Definition
--------+---------+------------
col1 | integer | col1
btree, for table "mx_test_schema_1.mx_table_1"
(1 row)
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_2.mx_table_2'::regclass;
Column | Type | Modifiers
@ -581,12 +581,12 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema
col2 | text |
(2 rows)
\d mx_test_schema_2.mx_index_2
Index "mx_test_schema_2.mx_index_2"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_2.mx_index_2'::regclass;
Column | Type | Definition
--------+------+------------
col2 | text | col2
btree, for table "mx_test_schema_2.mx_table_2"
(1 row)
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_2.mx_table_2'::regclass;
Constraint | Definition
@ -722,26 +722,30 @@ SET client_min_messages TO 'ERROR';
CREATE INDEX mx_index_3 ON mx_test_schema_2.mx_table_2 USING hash (col1);
ALTER TABLE mx_test_schema_2.mx_table_2 ADD CONSTRAINT mx_table_2_col1_key UNIQUE (col1);
\c - - - :worker_1_port
\d mx_test_schema_2.mx_index_3
Index "mx_test_schema_2.mx_index_3"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_2.mx_index_3'::regclass;
Column | Type | Definition
--------+---------+------------
col1 | integer | col1
hash, for table "mx_test_schema_2.mx_table_2"
(1 row)
\d mx_test_schema_2.mx_table_2_col1_key
Index "mx_test_schema_2.mx_table_2_col1_key"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_2.mx_table_2_col1_key'::regclass;
Column | Type | Definition
--------+---------+------------
col1 | integer | col1
unique, btree, for table "mx_test_schema_2.mx_table_2"
(1 row)
-- Check that DROP INDEX statement is propagated
\c - - - :master_port
SET citus.multi_shard_commit_protocol TO '2pc';
DROP INDEX mx_test_schema_2.mx_index_3;
\c - - - :worker_1_port
\d mx_test_schema_2.mx_index_3
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_2.mx_index_3'::regclass;
ERROR: relation "mx_test_schema_2.mx_index_3" does not exist
LINE 2: relid = 'mx_test_schema_2.mx_index_3'::regclass;
^
-- Check that ALTER TABLE statements are propagated
\c - - - :master_port
SET citus.multi_shard_commit_protocol TO '2pc';
@ -1293,12 +1297,12 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regcl
col_3 | numeric | default 0
(3 rows)
\d mx_ref_index
Index "public.mx_ref_index"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_ref_index'::regclass;
Column | Type | Definition
--------+---------+------------
col_1 | integer | col_1
btree, for table "public.mx_ref"
(1 row)
\c - - - :worker_1_port
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regclass;
@ -1309,20 +1313,28 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regcl
col_3 | numeric | default 0
(3 rows)
\d mx_ref_index
Index "public.mx_ref_index"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_ref_index'::regclass;
Column | Type | Definition
--------+---------+------------
col_1 | integer | col_1
btree, for table "public.mx_ref"
(1 row)
-- Check that metada is cleaned successfully upon drop table
\c - - - :master_port
DROP TABLE mx_ref;
\d mx_ref
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_ref_index'::regclass;
ERROR: relation "mx_ref_index" does not exist
LINE 2: relid = 'mx_ref_index'::regclass;
^
\c - - - :worker_1_port
\d mx_ref
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_ref_index'::regclass;
ERROR: relation "mx_ref_index" does not exist
LINE 2: relid = 'mx_ref_index'::regclass;
^
SELECT * FROM pg_dist_shard WHERE shardid=:ref_table_shardid;
logicalrelid | shardid | shardstorage | shardminvalue | shardmaxvalue
--------------+---------+--------------+---------------+---------------

View File

@ -212,7 +212,24 @@ ERROR: permission denied for table test
ABORT;
SELECT * FROM citus_stat_statements_reset();
ERROR: permission denied for function citus_stat_statements_reset
-- table owner should be the same on the shards, even when distributing the table as superuser
SET ROLE full_access;
CREATE TABLE my_table (id integer, val integer);
RESET ROLE;
SELECT create_distributed_table('my_table', 'id');
create_distributed_table
--------------------------
(1 row)
SELECT result FROM run_command_on_workers($$SELECT tableowner FROM pg_tables WHERE tablename LIKE 'my_table_%' LIMIT 1$$);
result
-------------
full_access
full_access
(2 rows)
DROP TABLE my_table;
DROP TABLE test;
DROP USER full_access;
DROP USER read_access;

View File

@ -36,18 +36,13 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table':
version | integer | not null default 1
(3 rows)
\d ddl_test*_index
Index "public.ddl_test_concurrent_index"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table"
Index "public.ddl_test_index"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table"
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index';
relname | Column | Type | Definition
---------------------------+--------+---------+------------
ddl_test_index | value | integer | value
ddl_test_concurrent_index | value | integer | value
(2 rows)
\c - - - :worker_1_port
-- make sure we don't break the following tests by hiding the shard names
@ -60,18 +55,13 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table':
version | integer | not null default 1
(3 rows)
\d ddl_test*_index
Index "public.ddl_test_concurrent_index"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table"
Index "public.ddl_test_index"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table"
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index';
relname | Column | Type | Definition
---------------------------+--------+---------+------------
ddl_test_index | value | integer | value
ddl_test_concurrent_index | value | integer | value
(2 rows)
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table_1220088'::regclass;
Column | Type | Modifiers
@ -81,18 +71,13 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table_1
version | integer | not null default 1
(3 rows)
\d ddl_test*_index_1220088
Index "public.ddl_test_concurrent_index_1220088"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table_1220088"
Index "public.ddl_test_index_1220088"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table_1220088"
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index_1220088';
relname | Column | Type | Definition
-----------------------------------+--------+---------+------------
ddl_test_index_1220088 | value | integer | value
ddl_test_concurrent_index_1220088 | value | integer | value
(2 rows)
\c - - - :worker_2_port
-- make sure we don't break the following tests by hiding the shard names
@ -105,18 +90,13 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table':
version | integer | not null default 1
(3 rows)
\d ddl_test*_index
Index "public.ddl_test_concurrent_index"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table"
Index "public.ddl_test_index"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table"
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index';
relname | Column | Type | Definition
---------------------------+--------+---------+------------
ddl_test_index | value | integer | value
ddl_test_concurrent_index | value | integer | value
(2 rows)
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table_1220089'::regclass;
Column | Type | Modifiers
@ -126,18 +106,13 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table_1
version | integer | not null default 1
(3 rows)
\d ddl_test*_index_1220089
Index "public.ddl_test_concurrent_index_1220089"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table_1220089"
Index "public.ddl_test_index_1220089"
Column | Type | Definition
--------+---------+------------
value | integer | value
btree, for table "public.mx_ddl_table_1220089"
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index_1220089';
relname | Column | Type | Definition
-----------------------------------+--------+---------+------------
ddl_test_index_1220089 | value | integer | value
ddl_test_concurrent_index_1220089 | value | integer | value
(2 rows)
INSERT INTO mx_ddl_table VALUES (37, 78, 2);
INSERT INTO mx_ddl_table VALUES (38, 78);

View File

@ -53,19 +53,19 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='distributed_mx
value | jsonb |
(2 rows)
\d distributed_mx_table_pkey
Index "public.distributed_mx_table_pkey"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'distributed_mx_table_pkey'::regclass;
Column | Type | Definition
--------+------+------------
key | text | key
primary key, btree, for table "public.distributed_mx_table"
(1 row)
\d distributed_mx_table_value_idx
Index "public.distributed_mx_table_value_idx"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'distributed_mx_table_value_idx'::regclass;
Column | Type | Definition
--------+------+------------
value | text | value
gin, for table "public.distributed_mx_table"
(1 row)
SELECT repmodel FROM pg_dist_partition
WHERE logicalrelid = 'distributed_mx_table'::regclass;
@ -89,19 +89,19 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='distributed_mx
value | jsonb |
(2 rows)
\d distributed_mx_table_pkey
Index "public.distributed_mx_table_pkey"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'distributed_mx_table_pkey'::regclass;
Column | Type | Definition
--------+------+------------
key | text | key
primary key, btree, for table "public.distributed_mx_table"
(1 row)
\d distributed_mx_table_value_idx
Index "public.distributed_mx_table_value_idx"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'distributed_mx_table_value_idx'::regclass;
Column | Type | Definition
--------+------+------------
value | text | value
gin, for table "public.distributed_mx_table"
(1 row)
SELECT repmodel FROM pg_dist_partition
WHERE logicalrelid = 'distributed_mx_table'::regclass;

View File

@ -117,18 +117,13 @@ ERROR: renaming constraints belonging to distributed tables is currently unsupp
-- Verify that CREATE INDEX on already distributed table has proper shard names.
CREATE INDEX tmp_idx_12345678901234567890123456789012345678901234567890 ON name_lengths(col2);
\c - - - :worker_1_port
\d tmp_idx_*
Index "public.tmp_idx_123456789012345678901234567890123456789_5e470afa_225002"
Column | Type | Definition
--------+---------+------------
col2 | integer | col2
btree, for table "public.name_lengths_225002"
Index "public.tmp_idx_123456789012345678901234567890123456789_5e470afa_225003"
Column | Type | Definition
--------+---------+------------
col2 | integer | col2
btree, for table "public.name_lengths_225003"
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'tmp_idx_%';
relname | Column | Type | Definition
-----------------------------------------------------------------+--------+---------+------------
tmp_idx_123456789012345678901234567890123456789_5e470afa_225003 | col2 | integer | col2
tmp_idx_123456789012345678901234567890123456789_5e470afa_225002 | col2 | integer | col2
(2 rows)
\c - - - :master_port
-- Verify that a new index name > 63 characters is auto-truncated
@ -136,30 +131,15 @@ btree, for table "public.name_lengths_225003"
CREATE INDEX tmp_idx_123456789012345678901234567890123456789012345678901234567890 ON name_lengths(col2);
NOTICE: identifier "tmp_idx_123456789012345678901234567890123456789012345678901234567890" will be truncated to "tmp_idx_1234567890123456789012345678901234567890123456789012345"
\c - - - :worker_1_port
\d tmp_idx_*
Index "public.tmp_idx_123456789012345678901234567890123456789_599636aa_225002"
Column | Type | Definition
--------+---------+------------
col2 | integer | col2
btree, for table "public.name_lengths_225002"
Index "public.tmp_idx_123456789012345678901234567890123456789_599636aa_225003"
Column | Type | Definition
--------+---------+------------
col2 | integer | col2
btree, for table "public.name_lengths_225003"
Index "public.tmp_idx_123456789012345678901234567890123456789_5e470afa_225002"
Column | Type | Definition
--------+---------+------------
col2 | integer | col2
btree, for table "public.name_lengths_225002"
Index "public.tmp_idx_123456789012345678901234567890123456789_5e470afa_225003"
Column | Type | Definition
--------+---------+------------
col2 | integer | col2
btree, for table "public.name_lengths_225003"
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'tmp_idx_%';
relname | Column | Type | Definition
-----------------------------------------------------------------+--------+---------+------------
tmp_idx_123456789012345678901234567890123456789_5e470afa_225003 | col2 | integer | col2
tmp_idx_123456789012345678901234567890123456789_5e470afa_225002 | col2 | integer | col2
tmp_idx_123456789012345678901234567890123456789_599636aa_225003 | col2 | integer | col2
tmp_idx_123456789012345678901234567890123456789_599636aa_225002 | col2 | integer | col2
(4 rows)
\c - - - :master_port
SET citus.shard_count TO 2;

View File

@ -1123,13 +1123,11 @@ SELECT relation::regclass, locktype, mode FROM pg_locks WHERE relation::regclass
partitioning_locks | relation | AccessShareLock
partitioning_locks_2009 | relation | AccessExclusiveLock
partitioning_locks_2009 | relation | AccessShareLock
partitioning_locks_2009 | relation | RowExclusiveLock
partitioning_locks_2009 | relation | ShareLock
partitioning_locks_2010 | relation | AccessExclusiveLock
partitioning_locks_2010 | relation | AccessShareLock
partitioning_locks_2010 | relation | RowExclusiveLock
partitioning_locks_2010 | relation | ShareLock
(10 rows)
(8 rows)
COMMIT;
-- test shard resource locks with master_modify_multiple_shards

View File

@ -332,8 +332,10 @@ EXECUTE prepared_partition_column_insert(3);
EXECUTE prepared_partition_column_insert(4);
EXECUTE prepared_partition_column_insert(5);
EXECUTE prepared_partition_column_insert(6);
-- suppress notice message caused by DROP ... CASCADE to prevent pg version difference
SET client_min_messages TO 'WARNING';
DROP TYPE test_composite_type CASCADE;
NOTICE: drop cascades to table router_executor_table column stats
RESET client_min_messages;
-- test router executor with prepare statements
CREATE TABLE prepare_table (
key int,

View File

@ -1336,13 +1336,13 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='reference_sche
value_5 | double precision |
(4 rows)
\d reference_schema.reference_index_2
Index "reference_schema.reference_index_2"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'reference_schema.reference_index_2'::regclass;
Column | Type | Definition
---------+------------------+------------
value_2 | double precision | value_2
value_3 | text | value_3
btree, for table "reference_schema.reference_table_ddl"
(2 rows)
-- also to the shard placements
\c - - - :worker_1_port
@ -1355,13 +1355,13 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='reference_sche
value_5 | double precision |
(4 rows)
\d reference_schema.reference_index_2_1250019
Index "reference_schema.reference_index_2_1250019"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'reference_schema.reference_index_2_1250019'::regclass;
Column | Type | Definition
---------+------------------+------------
value_2 | double precision | value_2
value_3 | text | value_3
btree, for table "reference_schema.reference_table_ddl_1250019"
(2 rows)
\c - - - :master_port
DROP INDEX reference_schema.reference_index_2;

View File

@ -687,20 +687,20 @@ SET search_path TO public;
-- CREATE index
CREATE INDEX index1 ON test_schema_support.nation_hash(n_name);
--verify INDEX is created
\d test_schema_support.index1
Index "test_schema_support.index1"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'test_schema_support.index1'::regclass;
Column | Type | Definition
--------+---------------+------------
n_name | character(25) | n_name
btree, for table "test_schema_support.nation_hash"
(1 row)
\c - - - :worker_1_port
\d test_schema_support.index1_1190003
Index "test_schema_support.index1_1190003"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'test_schema_support.index1_1190003'::regclass;
Column | Type | Definition
--------+---------------+------------
n_name | character(25) | n_name
btree, for table "test_schema_support.nation_hash_1190003"
(1 row)
\c - - - :master_port
-- DROP index
@ -715,20 +715,20 @@ SET search_path TO test_schema_support;
-- CREATE index
CREATE INDEX index1 ON nation_hash(n_name);
--verify INDEX is created
\d test_schema_support.index1
Index "test_schema_support.index1"
SELECT "Column", "Type", "Definition" FROM public.index_attrs WHERE
relid = 'test_schema_support.index1'::regclass;
Column | Type | Definition
--------+---------------+------------
n_name | character(25) | n_name
btree, for table "test_schema_support.nation_hash"
(1 row)
\c - - - :worker_1_port
\d test_schema_support.index1_1190003
Index "test_schema_support.index1_1190003"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'test_schema_support.index1_1190003'::regclass;
Column | Type | Definition
--------+---------------+------------
n_name | character(25) | n_name
btree, for table "test_schema_support.nation_hash_1190003"
(1 row)
\c - - - :master_port
-- DROP index

View File

@ -77,6 +77,31 @@ FROM information_schema.check_constraints cc,
WHERE cc.constraint_schema = ccu.constraint_schema AND
cc.constraint_name = ccu.constraint_name
ORDER BY cc.constraint_name ASC;
CREATE VIEW index_attrs AS
WITH indexoid AS (
SELECT c.oid,
n.nspname,
c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 2, 3
)
SELECT
indexoid.nspname AS "nspname",
indexoid.relname AS "relname",
a.attrelid AS "relid",
a.attname AS "Column",
pg_catalog.format_type(a.atttypid, a.atttypmod) AS "Type",
pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS "Definition"
FROM pg_catalog.pg_attribute a
LEFT JOIN indexoid ON (a.attrelid = indexoid.oid)
WHERE true
AND a.attnum > 0
AND NOT a.attisdropped
ORDER BY a.attrelid, a.attnum;
$desc_views$
);
run_command_on_master_and_workers

View File

@ -392,8 +392,10 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.mx_tabl
col_3 | bigint | not null default nextval('mx_table_col_3_seq'::regclass)
(3 rows)
-- suppress notice message caused by DROP ... CASCADE to prevent pg version difference
SET client_min_messages TO 'WARNING';
DROP SEQUENCE mx_table_col_3_seq CASCADE;
NOTICE: drop cascades to default for table mx_table column col_3
RESET client_min_messages;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.mx_table'::regclass;
Column | Type | Modifiers
--------+---------+-----------

View File

@ -10,16 +10,12 @@ SELECT substring(:'server_version', '\d+')::int > 10 as version_above_ten;
-- ===================================================================
-- test utility statement functionality
-- ===================================================================
SET citus.shard_count TO 2;
SET citus.shard_replication_factor TO 1;
CREATE TABLE sharded_table ( name text, id bigint );
SELECT master_create_distributed_table('sharded_table', 'id', 'hash');
master_create_distributed_table
---------------------------------
(1 row)
SELECT master_create_worker_shards('sharded_table', 2, 1);
master_create_worker_shards
-----------------------------
SELECT create_distributed_table('sharded_table', 'id', 'hash');
create_distributed_table
--------------------------
(1 row)
@ -167,16 +163,12 @@ ERROR: no locks specified
DROP TABLE sharded_table;
-- VACUUM tests
-- create a table with a single shard (for convenience)
SET citus.shard_count TO 1;
SET citus.shard_replication_factor TO 2;
CREATE TABLE dustbunnies (id integer, name text, age integer);
SELECT master_create_distributed_table('dustbunnies', 'id', 'hash');
master_create_distributed_table
---------------------------------
(1 row)
SELECT master_create_worker_shards('dustbunnies', 1, 2);
master_create_worker_shards
-----------------------------
SELECT create_distributed_table('dustbunnies', 'id', 'hash');
create_distributed_table
--------------------------
(1 row)

View File

@ -182,8 +182,8 @@ SELECT o_orderkey, l_linenumber FROM priority_orders left join air_shipped_linei
-- it passes planning, fails at execution stage
SET client_min_messages TO DEBUG1;
SELECT * FROM priority_orders JOIN air_shipped_lineitems ON (o_custkey = l_suppkey) ORDER BY o_orderkey DESC, o_custkey DESC, o_orderpriority DESC LIMIT 5;
DEBUG: generating subplan 22_1 for subquery SELECT lineitem_hash_part.l_orderkey, lineitem_hash_part.l_partkey, lineitem_hash_part.l_suppkey, lineitem_hash_part.l_linenumber, lineitem_hash_part.l_quantity, lineitem_hash_part.l_extendedprice, lineitem_hash_part.l_discount, lineitem_hash_part.l_tax, lineitem_hash_part.l_returnflag, lineitem_hash_part.l_linestatus, lineitem_hash_part.l_shipdate, lineitem_hash_part.l_commitdate, lineitem_hash_part.l_receiptdate, lineitem_hash_part.l_shipinstruct, lineitem_hash_part.l_shipmode, lineitem_hash_part.l_comment FROM public.lineitem_hash_part WHERE (lineitem_hash_part.l_shipmode = 'AIR'::bpchar)
DEBUG: Plan 22 query after replacing subqueries and CTEs: SELECT priority_orders.o_orderkey, priority_orders.o_custkey, priority_orders.o_orderstatus, priority_orders.o_totalprice, priority_orders.o_orderdate, priority_orders.o_orderpriority, priority_orders.o_clerk, priority_orders.o_shippriority, priority_orders.o_comment, air_shipped_lineitems.l_orderkey, air_shipped_lineitems.l_partkey, air_shipped_lineitems.l_suppkey, air_shipped_lineitems.l_linenumber, air_shipped_lineitems.l_quantity, air_shipped_lineitems.l_extendedprice, air_shipped_lineitems.l_discount, air_shipped_lineitems.l_tax, air_shipped_lineitems.l_returnflag, air_shipped_lineitems.l_linestatus, air_shipped_lineitems.l_shipdate, air_shipped_lineitems.l_commitdate, air_shipped_lineitems.l_receiptdate, air_shipped_lineitems.l_shipinstruct, air_shipped_lineitems.l_shipmode, air_shipped_lineitems.l_comment FROM ((SELECT orders_hash_part.o_orderkey, orders_hash_part.o_custkey, orders_hash_part.o_orderstatus, orders_hash_part.o_totalprice, orders_hash_part.o_orderdate, orders_hash_part.o_orderpriority, orders_hash_part.o_clerk, orders_hash_part.o_shippriority, orders_hash_part.o_comment FROM public.orders_hash_part WHERE (orders_hash_part.o_orderpriority < '3-MEDIUM'::bpchar)) priority_orders JOIN (SELECT intermediate_result.l_orderkey, intermediate_result.l_partkey, intermediate_result.l_suppkey, intermediate_result.l_linenumber, intermediate_result.l_quantity, intermediate_result.l_extendedprice, intermediate_result.l_discount, intermediate_result.l_tax, intermediate_result.l_returnflag, intermediate_result.l_linestatus, intermediate_result.l_shipdate, intermediate_result.l_commitdate, intermediate_result.l_receiptdate, intermediate_result.l_shipinstruct, intermediate_result.l_shipmode, intermediate_result.l_comment FROM read_intermediate_result('22_1'::text, 'binary'::citus_copy_format) intermediate_result(l_orderkey bigint, l_partkey integer, l_suppkey integer, l_linenumber integer, l_quantity numeric(15,2), l_extendedprice numeric(15,2), l_discount numeric(15,2), l_tax numeric(15,2), l_returnflag character(1), l_linestatus character(1), l_shipdate date, l_commitdate date, l_receiptdate date, l_shipinstruct character(25), l_shipmode character(10), l_comment character varying(44))) air_shipped_lineitems ON ((priority_orders.o_custkey = air_shipped_lineitems.l_suppkey))) ORDER BY priority_orders.o_orderkey DESC, priority_orders.o_custkey DESC, priority_orders.o_orderpriority DESC LIMIT 5
DEBUG: generating subplan 22_1 for subquery SELECT lineitem_hash_part.l_orderkey, lineitem_hash_part.l_partkey, lineitem_hash_part.l_suppkey, lineitem_hash_part.l_linenumber, lineitem_hash_part.l_quantity, lineitem_hash_part.l_extendedprice, lineitem_hash_part.l_discount, lineitem_hash_part.l_tax, lineitem_hash_part.l_returnflag, lineitem_hash_part.l_linestatus, lineitem_hash_part.l_shipdate, lineitem_hash_part.l_commitdate, lineitem_hash_part.l_receiptdate, lineitem_hash_part.l_shipinstruct, lineitem_hash_part.l_shipmode, lineitem_hash_part.l_comment FROM public.lineitem_hash_part WHERE (lineitem_hash_part.l_shipmode OPERATOR(pg_catalog.=) 'AIR'::bpchar)
DEBUG: Plan 22 query after replacing subqueries and CTEs: SELECT priority_orders.o_orderkey, priority_orders.o_custkey, priority_orders.o_orderstatus, priority_orders.o_totalprice, priority_orders.o_orderdate, priority_orders.o_orderpriority, priority_orders.o_clerk, priority_orders.o_shippriority, priority_orders.o_comment, air_shipped_lineitems.l_orderkey, air_shipped_lineitems.l_partkey, air_shipped_lineitems.l_suppkey, air_shipped_lineitems.l_linenumber, air_shipped_lineitems.l_quantity, air_shipped_lineitems.l_extendedprice, air_shipped_lineitems.l_discount, air_shipped_lineitems.l_tax, air_shipped_lineitems.l_returnflag, air_shipped_lineitems.l_linestatus, air_shipped_lineitems.l_shipdate, air_shipped_lineitems.l_commitdate, air_shipped_lineitems.l_receiptdate, air_shipped_lineitems.l_shipinstruct, air_shipped_lineitems.l_shipmode, air_shipped_lineitems.l_comment FROM ((SELECT orders_hash_part.o_orderkey, orders_hash_part.o_custkey, orders_hash_part.o_orderstatus, orders_hash_part.o_totalprice, orders_hash_part.o_orderdate, orders_hash_part.o_orderpriority, orders_hash_part.o_clerk, orders_hash_part.o_shippriority, orders_hash_part.o_comment FROM public.orders_hash_part WHERE (orders_hash_part.o_orderpriority OPERATOR(pg_catalog.<) '3-MEDIUM'::bpchar)) priority_orders JOIN (SELECT intermediate_result.l_orderkey, intermediate_result.l_partkey, intermediate_result.l_suppkey, intermediate_result.l_linenumber, intermediate_result.l_quantity, intermediate_result.l_extendedprice, intermediate_result.l_discount, intermediate_result.l_tax, intermediate_result.l_returnflag, intermediate_result.l_linestatus, intermediate_result.l_shipdate, intermediate_result.l_commitdate, intermediate_result.l_receiptdate, intermediate_result.l_shipinstruct, intermediate_result.l_shipmode, intermediate_result.l_comment FROM read_intermediate_result('22_1'::text, 'binary'::citus_copy_format) intermediate_result(l_orderkey bigint, l_partkey integer, l_suppkey integer, l_linenumber integer, l_quantity numeric(15,2), l_extendedprice numeric(15,2), l_discount numeric(15,2), l_tax numeric(15,2), l_returnflag character(1), l_linestatus character(1), l_shipdate date, l_commitdate date, l_receiptdate date, l_shipinstruct character(25), l_shipmode character(10), l_comment character varying(44))) air_shipped_lineitems ON ((priority_orders.o_custkey OPERATOR(pg_catalog.=) air_shipped_lineitems.l_suppkey))) ORDER BY priority_orders.o_orderkey DESC, priority_orders.o_custkey DESC, priority_orders.o_orderpriority DESC LIMIT 5
DEBUG: push down of limit count: 5
o_orderkey | o_custkey | o_orderstatus | o_totalprice | o_orderdate | o_orderpriority | o_clerk | o_shippriority | o_comment | 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
------------+-----------+---------------+--------------+-------------+-----------------+-----------------+----------------+-------------------------------------------------------+------------+-----------+-----------+--------------+------------+-----------------+------------+-------+--------------+--------------+------------+--------------+---------------+---------------------------+------------+-------------------------------------------

View File

@ -2,10 +2,10 @@
--- tests around access tracking within transaction blocks
---
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int AS server_version;
server_version
----------------
10
SELECT substring(:'server_version', '\d+')::int >= 10 AS version_ten_or_above;
version_ten_or_above
----------------------
t
(1 row)
CREATE SCHEMA access_tracking;

View File

@ -2,10 +2,10 @@
--- tests around access tracking within transaction blocks
---
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int AS server_version;
server_version
----------------
9
SELECT substring(:'server_version', '\d+')::int >= 10 AS version_ten_or_above;
version_ten_or_above
----------------------
f
(1 row)
CREATE SCHEMA access_tracking;

View File

@ -193,7 +193,8 @@ ALTER TABLE lineitem_alter ADD COLUMN first integer;
COMMIT;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineitem_alter'::regclass;
\d temp_index_2
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'temp_index_2'::regclass;
ALTER TABLE lineitem_alter DROP COLUMN first;
DROP INDEX temp_index_2;
@ -470,7 +471,10 @@ SELECT create_distributed_table('sequence_deadlock_test', 'a');
BEGIN;
ALTER TABLE sequence_deadlock_test ADD COLUMN c int;
-- suppress notice message caused by DROP ... CASCADE to prevent pg version difference
SET client_min_messages TO 'WARNING';
DROP SEQUENCE sequence_deadlock_test_b_seq CASCADE;
RESET client_min_messages;
END;
DROP TABLE sequence_deadlock_test;

View File

@ -479,12 +479,12 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.lineite
first | integer |
(18 rows)
\d temp_index_2
Index "public.temp_index_2"
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'temp_index_2'::regclass;
Column | Type | Definition
------------+--------+------------
l_orderkey | bigint | l_orderkey
btree, for table "public.lineitem_alter"
(1 row)
ALTER TABLE lineitem_alter DROP COLUMN first;
DROP INDEX temp_index_2;
@ -960,8 +960,10 @@ SELECT create_distributed_table('sequence_deadlock_test', 'a');
BEGIN;
ALTER TABLE sequence_deadlock_test ADD COLUMN c int;
-- suppress notice message caused by DROP ... CASCADE to prevent pg version difference
SET client_min_messages TO 'WARNING';
DROP SEQUENCE sequence_deadlock_test_b_seq CASCADE;
NOTICE: drop cascades to default for table sequence_deadlock_test column b
RESET client_min_messages;
END;
DROP TABLE sequence_deadlock_test;
-- verify enable/disable trigger all works

View File

@ -3,6 +3,8 @@
-- there is foreign key relation between reference
-- tables and distributed tables
--
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int > 10 AS version_above_ten;
CREATE SCHEMA test_fkey_to_ref_in_tx;
SET search_path TO 'test_fkey_to_ref_in_tx';

View File

@ -225,7 +225,8 @@ CREATE TABLE check_example
);
SELECT create_distributed_table('check_example', 'partition_col', 'hash');
\c - - - :worker_1_port
\d check_example_partition_col_key_365056
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'check_example_partition_col_key_365056'::regclass;
SELECT "Constraint", "Definition" FROM table_checks WHERE relid='public.check_example_365056'::regclass;
\c - - - :master_port

View File

@ -90,8 +90,10 @@ SELECT * FROM pg_dist_partition ORDER BY logicalrelid;
SELECT * FROM pg_dist_shard ORDER BY shardid;
SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodename, nodeport;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
\d mx_testing_schema.mx_test_table_col_1_key
\d mx_testing_schema.mx_index
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_testing_schema.mx_test_table_col_1_key'::regclass;
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_testing_schema.mx_index'::regclass;
-- Check that pg_dist_colocation is not synced
SELECT * FROM pg_dist_colocation ORDER BY colocationid;
@ -140,8 +142,10 @@ SELECT * FROM pg_dist_partition ORDER BY logicalrelid;
SELECT * FROM pg_dist_shard ORDER BY shardid;
SELECT * FROM pg_dist_shard_placement ORDER BY shardid, nodename, nodeport;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_testing_schema.mx_test_table'::regclass;
\d mx_testing_schema.mx_test_table_col_1_key
\d mx_testing_schema.mx_index
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_testing_schema.mx_test_table_col_1_key'::regclass;
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_testing_schema.mx_index'::regclass;
SELECT count(*) FROM pg_trigger WHERE tgrelid='mx_testing_schema.mx_test_table'::regclass;
-- Make sure that start_metadata_sync_to_node cannot be called inside a transaction
@ -206,11 +210,14 @@ CREATE INDEX mx_index_2 ON mx_test_schema_2.mx_table_2 (col2);
ALTER TABLE mx_test_schema_2.mx_table_2 ADD CONSTRAINT mx_fk_constraint FOREIGN KEY(col1) REFERENCES mx_test_schema_1.mx_table_1(col1);
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_1.mx_table_1'::regclass;
\d mx_test_schema_1.mx_table_1_col1_key
\d mx_test_schema_1.mx_index_1
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_1.mx_table_1_col1_key'::regclass;
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_1.mx_index_1'::regclass;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_test_schema_2.mx_table_2'::regclass;
\d mx_test_schema_2.mx_index_2
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_2.mx_index_2'::regclass;
SELECT "Constraint", "Definition" FROM table_fkeys WHERE relid='mx_test_schema_2.mx_table_2'::regclass;
SELECT create_distributed_table('mx_test_schema_1.mx_table_1', 'col1');
@ -281,15 +288,18 @@ SET client_min_messages TO 'ERROR';
CREATE INDEX mx_index_3 ON mx_test_schema_2.mx_table_2 USING hash (col1);
ALTER TABLE mx_test_schema_2.mx_table_2 ADD CONSTRAINT mx_table_2_col1_key UNIQUE (col1);
\c - - - :worker_1_port
\d mx_test_schema_2.mx_index_3
\d mx_test_schema_2.mx_table_2_col1_key
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_2.mx_index_3'::regclass;
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_2.mx_table_2_col1_key'::regclass;
-- Check that DROP INDEX statement is propagated
\c - - - :master_port
SET citus.multi_shard_commit_protocol TO '2pc';
DROP INDEX mx_test_schema_2.mx_index_3;
\c - - - :worker_1_port
\d mx_test_schema_2.mx_index_3
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_test_schema_2.mx_index_3'::regclass;
-- Check that ALTER TABLE statements are propagated
\c - - - :master_port
@ -581,19 +591,24 @@ SELECT shardid AS ref_table_shardid FROM pg_dist_shard WHERE logicalrelid='mx_re
ALTER TABLE mx_ref ADD COLUMN col_3 NUMERIC DEFAULT 0;
CREATE INDEX mx_ref_index ON mx_ref(col_1);
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regclass;
\d mx_ref_index
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_ref_index'::regclass;
\c - - - :worker_1_port
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ref'::regclass;
\d mx_ref_index
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_ref_index'::regclass;
-- Check that metada is cleaned successfully upon drop table
\c - - - :master_port
DROP TABLE mx_ref;
\d mx_ref
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_ref_index'::regclass;
\c - - - :worker_1_port
\d mx_ref
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'mx_ref_index'::regclass;
SELECT * FROM pg_dist_shard WHERE shardid=:ref_table_shardid;
SELECT * FROM pg_dist_shard_placement WHERE shardid=:ref_table_shardid;

View File

@ -21,7 +21,8 @@ ALTER TABLE mx_ddl_table ALTER COLUMN version SET NOT NULL;
-- See that the changes are applied on coordinator, worker tables and shards
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table'::regclass;
\d ddl_test*_index
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index';
\c - - - :worker_1_port
@ -29,9 +30,11 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table':
SET citus.override_table_visibility TO FALSE;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table'::regclass;
\d ddl_test*_index
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index';
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table_1220088'::regclass;
\d ddl_test*_index_1220088
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index_1220088';
\c - - - :worker_2_port
@ -39,9 +42,11 @@ SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table_1
SET citus.override_table_visibility TO FALSE;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table'::regclass;
\d ddl_test*_index
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index';
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='mx_ddl_table_1220089'::regclass;
\d ddl_test*_index_1220089
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'ddl_test%_index_1220089';
INSERT INTO mx_ddl_table VALUES (37, 78, 2);
INSERT INTO mx_ddl_table VALUES (38, 78);

View File

@ -33,8 +33,10 @@ SELECT count(*) FROM pg_dist_transaction;
\c - - - :worker_1_port
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='distributed_mx_table'::regclass;
\d distributed_mx_table_pkey
\d distributed_mx_table_value_idx
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'distributed_mx_table_pkey'::regclass;
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'distributed_mx_table_value_idx'::regclass;
SELECT repmodel FROM pg_dist_partition
WHERE logicalrelid = 'distributed_mx_table'::regclass;
@ -45,8 +47,10 @@ WHERE logicalrelid = 'distributed_mx_table'::regclass;
\c - - - :worker_2_port
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='distributed_mx_table'::regclass;
\d distributed_mx_table_pkey
\d distributed_mx_table_value_idx
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'distributed_mx_table_pkey'::regclass;
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'distributed_mx_table_value_idx'::regclass;
SELECT repmodel FROM pg_dist_partition
WHERE logicalrelid = 'distributed_mx_table'::regclass;

View File

@ -74,7 +74,8 @@ ALTER TABLE name_lengths RENAME CONSTRAINT unique_123456789012345678901234567890
CREATE INDEX tmp_idx_12345678901234567890123456789012345678901234567890 ON name_lengths(col2);
\c - - - :worker_1_port
\d tmp_idx_*
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'tmp_idx_%';
\c - - - :master_port
-- Verify that a new index name > 63 characters is auto-truncated
@ -82,7 +83,8 @@ CREATE INDEX tmp_idx_12345678901234567890123456789012345678901234567890 ON name_
CREATE INDEX tmp_idx_123456789012345678901234567890123456789012345678901234567890 ON name_lengths(col2);
\c - - - :worker_1_port
\d tmp_idx_*
SELECT "relname", "Column", "Type", "Definition" FROM index_attrs WHERE
relname LIKE 'tmp_idx_%';
\c - - - :master_port
SET citus.shard_count TO 2;

View File

@ -201,7 +201,10 @@ EXECUTE prepared_partition_column_insert(4);
EXECUTE prepared_partition_column_insert(5);
EXECUTE prepared_partition_column_insert(6);
-- suppress notice message caused by DROP ... CASCADE to prevent pg version difference
SET client_min_messages TO 'WARNING';
DROP TYPE test_composite_type CASCADE;
RESET client_min_messages;
-- test router executor with prepare statements
CREATE TABLE prepare_table (

View File

@ -859,12 +859,14 @@ ALTER TABLE reference_schema.reference_table_ddl ALTER COLUMN value_3 SET NOT NU
-- see that Citus applied all DDLs to the table
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='reference_schema.reference_table_ddl'::regclass;
\d reference_schema.reference_index_2
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'reference_schema.reference_index_2'::regclass;
-- also to the shard placements
\c - - - :worker_1_port
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='reference_schema.reference_table_ddl_1250019'::regclass;
\d reference_schema.reference_index_2_1250019
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'reference_schema.reference_index_2_1250019'::regclass;
\c - - - :master_port
DROP INDEX reference_schema.reference_index_2;
\c - - - :worker_1_port

View File

@ -463,9 +463,11 @@ SET search_path TO public;
CREATE INDEX index1 ON test_schema_support.nation_hash(n_name);
--verify INDEX is created
\d test_schema_support.index1
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'test_schema_support.index1'::regclass;
\c - - - :worker_1_port
\d test_schema_support.index1_1190003
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'test_schema_support.index1_1190003'::regclass;
\c - - - :master_port
-- DROP index
@ -484,9 +486,11 @@ SET search_path TO test_schema_support;
CREATE INDEX index1 ON nation_hash(n_name);
--verify INDEX is created
\d test_schema_support.index1
SELECT "Column", "Type", "Definition" FROM public.index_attrs WHERE
relid = 'test_schema_support.index1'::regclass;
\c - - - :worker_1_port
\d test_schema_support.index1_1190003
SELECT "Column", "Type", "Definition" FROM index_attrs WHERE
relid = 'test_schema_support.index1_1190003'::regclass;
\c - - - :master_port
-- DROP index

View File

@ -79,5 +79,30 @@ FROM information_schema.check_constraints cc,
WHERE cc.constraint_schema = ccu.constraint_schema AND
cc.constraint_name = ccu.constraint_name
ORDER BY cc.constraint_name ASC;
CREATE VIEW index_attrs AS
WITH indexoid AS (
SELECT c.oid,
n.nspname,
c.relname
FROM pg_catalog.pg_class c
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
WHERE pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 2, 3
)
SELECT
indexoid.nspname AS "nspname",
indexoid.relname AS "relname",
a.attrelid AS "relid",
a.attname AS "Column",
pg_catalog.format_type(a.atttypid, a.atttypmod) AS "Type",
pg_catalog.pg_get_indexdef(a.attrelid, a.attnum, TRUE) AS "Definition"
FROM pg_catalog.pg_attribute a
LEFT JOIN indexoid ON (a.attrelid = indexoid.oid)
WHERE true
AND a.attnum > 0
AND NOT a.attisdropped
ORDER BY a.attrelid, a.attnum;
$desc_views$
);

View File

@ -212,7 +212,10 @@ DROP SEQUENCE some_sequence;
-- Show that dropping the sequence of an MX table with cascade harms the table and shards
BEGIN;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.mx_table'::regclass;
-- suppress notice message caused by DROP ... CASCADE to prevent pg version difference
SET client_min_messages TO 'WARNING';
DROP SEQUENCE mx_table_col_3_seq CASCADE;
RESET client_min_messages;
SELECT "Column", "Type", "Modifiers" FROM table_desc WHERE relid='public.mx_table'::regclass;
ROLLBACK;

View File

@ -3,7 +3,7 @@
--- tests around access tracking within transaction blocks
---
SHOW server_version \gset
SELECT substring(:'server_version', '\d+')::int AS server_version;
SELECT substring(:'server_version', '\d+')::int >= 10 AS version_ten_or_above;
CREATE SCHEMA access_tracking;
SET search_path TO 'access_tracking';