Thread: Question/problem with create view and restore a backup with such a view

Question/problem with create view and restore a backup with such a view

From
Franz.Rasper@izb.de
Date:

Hello,

i have following situation:

Postgres 7.2.1 (Debian woody)

I created a view (look into the attached file, the file was converted with nedit from unix to windows )
and if I paste it into psql it works. I can also do a select on this view (it works and is correct).

But if a want to restore a backup of this view it doesnt work.
(backup was done with pg_dump, restore with pg_restore or cat file | psql database ).

So i decided to look at the definition of this view with \d viewname and try to put this
output into psql and I got the following error message:

ERROR:  parser: parse error at or near "SELECT"

I already wrote an small awk programme and relpaced " " by "\n" removed
all empty lines and compared the two output files with vimdiff, but I have
not found the error.

What is the best way to compare such sql statement in postgres ?
Any very special DEBUG switch at psql or statement in the postgresql.conf ?

Thanks in advance.
Best regards,

-Franz

<<createview.sql>>

Attachment
Franz.Rasper@izb.de writes:
> Postgres 7.2.1 (Debian woody)

This bug has been fixed since 7.2.2 ...

2002-06-15 14:38  tgl

    * src/backend/utils/adt/ruleutils.c (REL7_2_STABLE): Back-patch 7.3
    fix to fully parenthesize UNION/EXCEPT/INTERSECT queries in
    ruleutils output.  The previous partial parenthesization was a hack
    to get around grammar restrictions that have since been fixed; and
    as Sam O'Connor pointed out, there were cases where it didn't work.

The 7.2 branch is no longer supported at all, but if you insist on using
it you should at least be running the latest point-release, 7.2.8.
Reasons why can be found on this and following pages:
http://developer.postgresql.org/docs/postgres/release-7-2-8.html

            regards, tom lane