Re: Patch: plan invalidation vs stored procedures

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Martin Pihlak <martin.pihlak@gmail.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2008-08-07T04:04:39Z
Lists: pgsql-hackers
Martin Pihlak <martin.pihlak@gmail.com> writes:
> Changing statement result type is also currently prohibited in
> StorePreparedStatement. There maybe good reasons for this,

How about "the SQL spec says so"?

Admittedly, it's a bit of a jump from views to prepared statements,
but the spec is perfectly clear that altering a table doesn't alter
any views dependent on it: SQL99 11.11 <add column definition> saith

            NOTE 189 - The addition of a column to a table has no effect on
            any existing <query expression> included in a view descriptor,
            <triggered action> included in a trigger descriptor, or <search
            condition> included in a constraint descriptor because any
            implicit column references in these descriptor elements are
            syntactically substituted by explicit column references under
            the Syntax Rules of Subclause 7.11, "<query specification>".
            Furthermore, by implication (from the lack of any General Rules
            to the contrary), the meaning of a column reference is never
            retroactively changed by the addition of a column subsequent
            to the invocation of the <SQL schema statement> containing that
            column reference.

and there was a comparable restriction in SQL92.  You'd need to make a
pretty strong argument why prepared statements should behave differently
from views to convince me that changing this is a good idea.

			regards, tom lane