Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-hackers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group