On 04/27/2012 08:25 AM, Abbas Butt wrote:
>
> The notation "relation.*" represents a whole-row reference.
> While parsing a whole-row reference is transformed into a Var with
> varno set to the correct range table entry,
> and varattno == 0 to signal that it references the whole tuple. (For
> reference see comments of function makeWholeRowVar)
> While deparsing we need to take care of this case.
> The attached patch provides deparsing of a whole-row reference.
> A whole row reference will be deparsed either into alias.*::relation
> or relation.*::relation depending on alias
>
I agree there's a bug, although it's easily worked around: in the case
of your example:
CREATE VIEW v2 AS SELECT p AS price FROM price p;
would do the trick.
However, is this a change we really want to make?:
pg_get_triggerdef
---------------------------------------------------------------------------------------------------------------------------------------------------------------
- CREATE TRIGGER modified_any BEFORE UPDATE OF a ON main_table FOR EACH ROW WHEN (old.* IS DISTINCT FROM new.*)
EXECUTEPROCEDURE trigger_func('modified_any') +
pg_get_triggerdef
+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ CREATE TRIGGER modified_any BEFORE UPDATE OF a ON main_table FOR EACH ROW WHEN (old.*::main_table IS DISTINCT FROM
new.*::main_table)EXECUTE PROCEDURE trigger_func('modified_any')
Maybe we need to be a bit more selective about when the cast is
supplied. It's not adding any extra disambiguation (or clarity) here.
cheers
andrew