From: | Keith Parks <emkxp01(at)mtcc(dot)demon(dot)co(dot)uk> |
---|---|
To: | wieck(at)debis(dot)com |
Cc: | hackers(at)postgresql(dot)org, oleg(at)sai(dot)msu(dot)su |
Subject: | Re: [HACKERS] 6.5 cvs: views doesn't survives after pg_dump (fwd) |
Date: | 1999-05-24 13:21:07 |
Message-ID: | 199905241321.OAA21686@mtcc.demon.co.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jan,
Have you any ideas on this?
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;
.
.
strcat(buf, " WHERE ");
strcat(buf, get_rule_expr(&qh, 0, qual, TRUE));
}
strcat(buf, " DO ");
/* The INSTEAD keyword (if so) */
if (is_instead)
strcat(buf, "INSTEAD ");
We put the WHERE in if strlen(ev_qual) > 0
I've not yet followed this back any further.
Keith.
------------ Begin Forwarded Message -------------
X-Authentication-Warning: hub.org: majordom set sender to
owner-pgsql-hackers(at)postgreSQL(dot)org using -f
Date: Fri, 21 May 1999 22:34:50 +0100 (BST)
From: Keith Parks <emkxp01(at)mtcc(dot)demon(dot)co(dot)uk>
Subject: Re: [HACKERS] 6.5 cvs: views doesn't survives after pg_dump (fwd)
To: pgsql-hackers(at)postgreSQL(dot)org, oleg(at)sai(dot)msu(dot)su
MIME-Version: 1.0
Content-MD5: 34XqWKKsmVlyonlE1gsMzw==
Oleg Bartunov < oleg(at)sai(dot)msu(dot)su>
> After dumping (by pg_dump) and restoring views becomes a tables
>
The problem is that views are dumped with anm extraneous "WHERE"
> ............................
> QUERY: COPY "t1" FROM stdin;
> CREATE RULE "_RETv1" AS ON SELECT TO "v1" WHERE DO INSTEAD SELECT "a" FROM
"t1";
> QUERY: CREATE RULE "_RETv1" AS ON SELECT TO "v1" WHERE DO INSTEAD SELECT "a"
FROM "t1";
...................................................++++++
> ERROR: parser: parse error at or near "do"
> EOF
Which causes this error and the rule (View) is not Created.
I don't know how the where clause gets in there but if you
edit the dump before restoring all is OK.
Keith.
------------- End Forwarded Message -------------
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1999-05-24 13:40:32 | Re: [HACKERS] ERROR: WaitOnLock: error on wakeup - Aborting this transaction |
Previous Message | Lincoln Spiteri | 1999-05-24 13:16:39 | Re: [GENERAL] Full Text Searches |