Re: [GENERAL] search_path versus dynamic CREATE SCHEMA

2011-05-31 Thread Brendan Jurd
On 1 June 2011 13:08, Tom Lane wrote: > Brendan Jurd writes: >> It seems that the first call to make_schema succeeds, but the second >> fails when it gets to the INSERT.  The duplicate key complaint seems >> to suggest that the INSERT statement is resolving t as a.t, instead of >> the newly creat

Re: [GENERAL] search_path versus dynamic CREATE SCHEMA

2011-05-31 Thread Tom Lane
Brendan Jurd writes: > CREATE OR REPLACE FUNCTION make_schema(_name text) > RETURNS void LANGUAGE plpgsql VOLATILE AS $$ > DECLARE > _quoted text; > BEGIN > _quoted = quote_ident(_name); > EXECUTE 'CREATE SCHEMA ' || _quoted; > EXECUTE 'SET LOCAL search_path

[GENERAL] search_path versus dynamic CREATE SCHEMA

2011-05-31 Thread Brendan Jurd
Hi folks, I am curious about why the following doesn't work as expected (tested on 9.0.3 and HEAD). CREATE OR REPLACE FUNCTION make_schema(_name text) RETURNS void LANGUAGE plpgsql VOLATILE AS $$ DECLARE _quoted text; BEGIN _quoted = quote_ident(_name); EXECUTE 'CR