Re: read-only planner input

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: Oliver Jowett <oliver(at)opencloud(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: read-only planner input
Date: 2005-03-19 04:13:01
Message-ID: 12360.1111205581@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Neil Conway <neilc(at)samurai(dot)com> writes:
> ... By not well-defined, I meant that
> if the user is changing GUC variables on the fly, they can't rely on
> their prepared query being planned under any particular datestyle (or
> search path, etc.), since they can't really predict when replanning will
> take place (e.g. an sinval overflow could occur spontaneously and cause
> all cached plans to be invalidated). This is similar to how search_path
> and pl/pgsql works right now -- we'll use the search_path in effect when
> the query is planned, which may or may not be what the user would expect.

As soon as we have the replanning mechanism, I think that there will be
considerable pressure to use it to ensure that search_path changes and
so on *do* behave consistently.

The question here is what does "consistently" mean.

My first thought is that the best idea in most scenarios would be to
associate a search_path value with each function, rather than allowing
the meaning of queries within each function to vary depending on the
caller's search_path. We have seen one or two examples where the user
would rather have the other behavior --- but they are surely a small
minority.

I'm not sure though that I care to extend that thought to each
individual GUC variable ... even though it's surely true that changes
in e.g. datestyle could break a particular function. The contrary
argument is that GUC variables are useful just because they represent
a single place to set some behavior, and having to fix the values
associated with N different functions would be a nightmare outweighing
the benefits of stable values for individual functions.

Any thoughts on how this stuff "ought to" behave?

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-03-19 04:31:26 Re: rewriter in updateable views
Previous Message Eric Parusel 2005-03-19 02:16:45 Re: corrupted tuple (header?), pg_filedump output