I have a script that looks like this:
BEGIN; SET client_min_messages TO warning; SET search_path TO geo; CREATE TABLE continents ( code CHARACTER(2) PRIMARY KEY, continent TEXT NOT NULL );
I ran this against a coordinator, and it seemed to work. But when I tried to select from the table, XC said it could not be found. \d geo.continents shows it, but only on the coordinator on which I ran the script. If I connect to any other coordinator or any data node, the continents table is in the public schema rather than the geo schema.
Bug? I don't see any mentinon of SET not being distributed in the SET docs. I can work around it by schema-qualifying objects, but would rather not have to.
Another search_path issue: If you have schema-qualified a data type in a table column, queries will fail against that table:
I guess the workaround would be to set the search_path to include all my schemas on in all the coordinator and data node
postgresql.conf
files?For the first case, here's a result with current master (as of Feb.3rd) and 1.1.
It seems to work. Can we share more specific issue you met?
Ah, the problem is setting the role. This works:
However, if I uncomment the
SET ROLE
line incontinents.sql
, I instead get:Cute, huh? Curiously, I don't seem to get this problem if I combine
schemas.sql
andcontinents.sql
into a single file:Furthermore, note that the
owner_references
role, while I can set it as the current role, has no login privileges. It was created like so:—David
Ah, it also works if I call
SET ROLE
beforeSET search_path
.Last edit: David E. Wheeler 2014-02-03
create schema bar;
CREATE SCHEMA
For the second case, I tested with 1.1 as follows:
It seems that the problem is not search_path propagation but handling aliases in the type.
Current master (as of 3rd Feb) had the same result. I don't think this is because the search_path is not propagated properly. Rather, the cause maybe XC schema does not handle type name qualification correctly.
Thanks for the confirmation. Can you think of a workaround other than including the
bar
schema in the search path before executing the query?