Re: [HACKERS] 6.5 cvs: views doesn't survives after pg_dump (fwd) - Mailing list pgsql-hackers

From jwieck@debis.com (Jan Wieck)
Subject Re: [HACKERS] 6.5 cvs: views doesn't survives after pg_dump (fwd)
Date
Msg-id m10mCLu-000EBPC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to Re: [HACKERS] 6.5 cvs: views doesn't survives after pg_dump (fwd)  (Keith Parks <emkxp01@mtcc.demon.co.uk>)
List pgsql-hackers
>
> Jan,
>
> Have you any ideas on this?

    Yepp

>
> We get a rule output by pg_dump like :-
>
> CREATE RULE "_RETsongs" AS
>   ON SELECT TO "songs"
>   WHERE  DO INSTEAD
>     SELECT "t"."artist", "t"."song", "t"."trackno", "d"."cdname"
>     FROM "disks" "d", "tracks" "t"
>     WHERE "d"."diskid" = "t"."diskid";
>
> from a view defined like so:-
>
> CREATE VIEW songs AS
>   SELECT t.artist, t.song, t.trackno, d.cdname
>   FROM disks d, tracks t
>   WHERE d.diskid = t.diskid;
>
> Note the WHERE keyword in line 3 of the rule define.
>
> >From "./src/backend/utils/adt/ruleutils.c" line 662 of 1814
>
>         /* If the rule has an event qualification, add it */
>         if (ev_qual == NULL)
>                 ev_qual = "";
>         if (strlen(ev_qual) > 0)
>         {
>                 Node       *qual;
>                 Query      *query;
>                 QryHier    qh;
> .
> .

    That's   exactly   the   location  AFAICS.  The  problem  was
    introduced when the storage of  rules  changed  in  that  the
    event  qualification is now stored as "<>" (the output of the
    node print functions for NULL) instead of a NULL attribute.

    I'll fix it soon - thanks.

>
> We put the WHERE in if strlen(ev_qual) > 0
>
> I've not yet followed this back any further.
>
> Keith.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #

pgsql-hackers by date:

Previous
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] createlang - ?
Next
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] Partial fix for INSERT...SELECT problems