Re: Another thought about search_path semantics

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

On 2014-04-04 14:32:46 -0400, Tom Lane wrote:
> 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".

I was actually suggesting that the only way to create something in
pg_catalog is to do it with a explicit schema qualified id. I realize
that that's not something backpatchable...

> 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?

I think "$user" really nailed that behaviour down. Everything else just
seems really confusing. We could of course make that behave special as
you suggest, but yuck.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-04-04 18:56:54 Re: Another thought about search_path semantics
Previous Message Tom Lane 2014-04-04 18:32:46 Re: Another thought about search_path semantics