Re: Another thought about search_path semantics - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Another thought about search_path semantics
Date
Msg-id 22639.1396636366@sss.pgh.pa.us
Whole thread Raw
In response to Re: Another thought about search_path semantics  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: Another thought about search_path semantics
List pgsql-hackers
Andres Freund <andres@2ndquadrant.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Another thought about search_path semantics
Next
From: Andres Freund
Date:
Subject: Re: Another thought about search_path semantics