Re: A problem with dump/restore of views containing whole row references

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Abbas Butt <abbas(dot)butt(at)enterprisedb(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A problem with dump/restore of views containing whole row references
Date: 2012-04-27 13:25:47
Message-ID: 4F9A9E5B.5050008@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.*) EXECUTE PROCEDURE 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2012-04-27 14:21:06 Re: default_transaction_isolation = serializable causes crash under Hot Standby
Previous Message Robert Haas 2012-04-27 13:15:16 default_transaction_isolation = serializable causes crash under Hot Standby