Re: Another thought about search_path semantics

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Another thought about search_path semantics
Date: 2014-04-04 18:32:46
Message-ID: 22639.1396636366@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> I was thinking - but not saying explicitly - of rigging things so that
> pg_catalog is ignored when searching for the target schema for object
> creation unless explicitly specified. So if there's no other schema in
> the search path you'd get the error about no "no schema has been
> selected to create in", even if pg_catalog is somewhere in there.

Hm. Seems pretty grotty, but it'd at least fix pg_dump's problem,
since pg_dump's lists are always "foo, pg_catalog" with no third
schema mentioned. I think what we'd actually need is to say
"pg_catalog cannot be selected as the creation target unless it's
the *first* entry in the search_path list".

The larger issue here is that if search_path is say "a, b, c" and
"a" doesn't exist, is it really sane to create in "b" instead?

Another relatively narrow fix we could consider is to revert to
treating "$user" specially, such that it can be skipped over if
nonexistent for the purpose of selecting a creation target, but
actual schema names cannot be.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-04-04 18:43:50 Re: Another thought about search_path semantics
Previous Message Tom Lane 2014-04-04 18:20:52 Re: Another thought about search_path semantics