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>
includedin 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
elementsare syntactically substituted by explicit column references under the Syntax Rules of
Subclause7.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
columnsubsequent 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