Skip to content

Alter table statments does not work when search_path is set #565

@onderkalaci

Description

@onderkalaci

This is related to 267. Again, worker_apply_shard_ddl_command() does not take schema into the consideration when search path is set.

Here is the steps to re-produce:

CREATE SCHEMA tpch;
CREATE TABLE tpch.nation_hash (
    n_nationkey integer not null,
    n_name char(25) not null,
    n_regionkey integer not null,
    n_comment varchar(152));

SELECT master_create_distributed_table('tpch.nation_hash', 'n_nationkey', 'hash');
SELECT master_create_worker_shards('tpch.nation_hash', 4, 1);

\COPY tpch.nation_hash FROM STDIN WITH CSV
1,'name',1,'comment_1'
2,'name',2,'comment_2'
3,'name',3,'comment_3'
4,'name',4,'comment_4'
5,'name',5,'comment_5'


SET search_path TO public;
ALTER TABLE tpch.nation_hash ADD COLUMN tmp_col INT;

ALTER TABLE tpch.nation_hash  DROP COLUMN IF EXISTS non_existent_column;

SET search_path TO tpch;
ALTER TABLE nation_hash ADD COLUMN tmp_col_2 INT;
WARNING:  could not receive query results from localhost:9700
DETAIL:  Client error: relation "nation_hash_102008" does not exist
ERROR:  could not execute DDL command on worker node shards

-- worker log
ERROR:  relation "nation_hash_102008" does not exist
STATEMENT:  SELECT worker_apply_shard_ddl_command (102008, 'ALTER TABLE nation_hash ADD COLUMN tmp_col_2 INT;')

ALTER TABLE nation_hash  DROP COLUMN IF EXISTS non_existent_column;
ALTER TABLE nation_hash ALTER COLUMN n_comment SET DEFAULT 'comment';

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions