fix \d change for indexes in pg11

pull/2324/head
Nils Dijk 2018-08-01 15:12:36 +02:00 committed by Jason Petersen
parent 2a9d47e1a6
commit 6cf4516fdb
No known key found for this signature in database
GPG Key ID: 9F1D3510D110ABA9
18 changed files with 252 additions and 201 deletions

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

@ -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

@ -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

@ -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;

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;

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

@ -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$
);