citusdata / citusdata/citus

`run_command_on_placements ` may fail for `public` schema when `public` is not in the search path

Open
#5,495 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
12.8k
Forks
794
Avg merge
2d 14h
Merged PRs (30d)
31

Description

Reported by @byucesoy.

In some systems, users remove `public` from search_path for security reasons. Given that `shard_name` treats `public` schema differently [here](https://github.com/citusdata/citus/blob/a8435620c4c81fe38f5c571ac9a554169801d615/src/backend/distributed/relay/relay_event_utility.c#L937)

```SQL
alter system set search_path to "$user";
SELECT run_command_on_workers($$alter system set search_path to "$user";$$);
SELECT pg_reload_conf();
SELECT run_command_on_workers($$SELECT pg_reload_conf();$$);

SET search_path TO public;
CREATE TABLE test_dist(a int);
SELECT create_distributed_table('test_dist', 'a');

CREATE SCHEMA test_schema;
SET search_path TO test_schema;

SELECT run_command_on_placements('public.test_dist', 'SELECT count(*) FROM %s') LIMIT 1;
run_command_on_placements
----------------------------------------------------------------------------------
(localhost,9700,102170,f,"ERROR: relation ""test_dist_102170"" does not exist")
(1 row)

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.