Re: Controlling changes in plpgsql variable resolution - Mailing list pgsql-hackers

From Robert Haas
Subject Re: Controlling changes in plpgsql variable resolution
Date
Msg-id 603c8f070910181457l34836c5fv8c375cfac42e9a31@mail.gmail.com
Whole thread Raw
In response to Re: Controlling changes in plpgsql variable resolution  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Sun, Oct 18, 2009 at 4:07 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> If possible, I think we should try to engineer things so that using
>> pg_dump 8.5 on an 8.4 database and restoring the result into an 8.5
>> database produces a function with identical semantics.
>
> Hmm ... actually, we could have pg_dump stick either a #option line
> or a GUC SET parameter onto every plpgsql function it pulls from an
> old database.  So if you're willing to assume that people do their
> upgrades that way, it could be made reasonably safe, even if the
> default behavior changes.

I'm not completely willing to assume that.  I know we recommend it,
but I'm sure that people don't always do it.  And this is pretty
subtle: someone might screw it up and get a non-working function
without realizing it.  The advantage of making the default behavior
"throw an error" is that it should be pretty obvious if you've broken
something.

And this isn't just about pg_dump, either.  I have a script that gets
run regularly on one of my production databases that goes an updates
the definitions of a whole bunch of functions to the latest version
from the source code repository.  Even if pg_dump DTRT, the next run
of a script of that type might subtly break a bunch of stuff.

The current behavior is a trap for the unwary, so I have no problem
with changing it.  But I think we should try really hard to avoid
creating a more subtle trap in the process.

...Robert


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Boosting cost estimates for some built-in functions
Next
From: u235sentinel
Date:
Subject: Re: postgres 8.3.8 and Solaris 10_x86 64 bit problems?