Re: A problem with dump/restore of views containing whole row references - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: A problem with dump/restore of views containing whole row references
Date
Msg-id 4F9A9E5B.5050008@dunslane.net
Whole thread Raw
In response to A problem with dump/restore of views containing whole row references  (Abbas Butt <abbas.butt@enterprisedb.com>)
Responses Re: A problem with dump/restore of views containing whole row references  (Abbas Butt <abbas.butt@enterprisedb.com>)
List pgsql-hackers

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: default_transaction_isolation = serializable causes crash under Hot Standby
Next
From: "Kevin Grittner"
Date:
Subject: Re: default_transaction_isolation = serializable causes crash under Hot Standby