Thread: 9.3beta2 unrecognized node type in join alias vars when retrieving view definition

9.3beta2 unrecognized node type in join alias vars when retrieving view definition

From
Feike Steenbergen
Date:
Hi all,

While testing the 9.3 beta I am unable to get the view definition for
some views.
Because of this I cannot use pg_dump to create a valid dump of the
specified database.

ERROR:  unrecognized node type in join alias vars: 309

- I can select from the views and the results are valid.
- The views use recursion
- I cannot reproduce this on a 9.2.4

Simple testcase:
- create the database
- load dumpfile from 9.2 into the database
- select something from the view
- select the view definition
- describe the view


postgres@fslaptop:~$ psql --command "CREATE DATABASE viewbugtest"
CREATE DATABASE
postgres@fslaptop:~$ zcat bugtest.sql.gz | psql --no-psqlrc
--single-transaction --quiet viewbugtest

[...]

postgres@fslaptop:~$ psql -E --no-psqlrc viewbugtest --command="SELECT
pg_catalog.pg_get_viewdef( (SELECT oid FROM pg_class WHERE
relname='gasverbruik_maand') )"
ERROR:  unrecognized node type in join alias vars: 309

postgres@fslaptop:~$ psql -E --no-psqlrc viewbugtest --command="SELECT
* FROM gasverbruik_maand LIMIT 1"
   maand    |   stand   | verbruik | dagverbruik | graaddagen
------------+-----------+----------+-------------+------------
 2009-01-01 | 28746.000 |   50.727 |       1.636 |      530.9
(1 row)

postgres@fslaptop:~$ psql --no-psqlrc viewbugtest --command="\dv+
gasverbruik_maand"
                         List of relations
 Schema |       Name        | Type | Owner |  Size   | Description
--------+-------------------+------+-------+---------+-------------
 public | gasverbruik_maand | view | feike | 0 bytes |
(1 row)



postgres@fslaptop:~$ pg_config
BINDIR = /postgres/app/pg93/bin
DOCDIR = /postgres/app/pg93/share/doc
HTMLDIR = /postgres/app/pg93/share/doc
INCLUDEDIR = /postgres/app/pg93/include
PKGINCLUDEDIR = /postgres/app/pg93/include
INCLUDEDIR-SERVER = /postgres/app/pg93/include/server
LIBDIR = /postgres/app/pg93/lib
PKGLIBDIR = /postgres/app/pg93/lib
LOCALEDIR = /postgres/app/pg93/share/locale
MANDIR = /postgres/app/pg93/share/man
SHAREDIR = /postgres/app/pg93/share
SYSCONFDIR = /postgres/app/pg93/etc
PGXS = /postgres/app/pg93/lib/pgxs/src/makefiles/pgxs.mk
CONFIGURE = '--prefix=/postgres/app/pg93' '--with-perl'
'--with-python' '--with-ldap' '--with-openssl' '--with-gssapi'
CC = gcc
CPPFLAGS = -D_GNU_SOURCE
CFLAGS = -O2 -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard
CFLAGS_SL = -fpic
LDFLAGS = -L../../../src/common -Wl,--as-needed
-Wl,-rpath,'/postgres/app/pg93/lib',--enable-new-dtags
LDFLAGS_EX =
LDFLAGS_SL =
LIBS = -lpgport -lpgcommon -lssl -lcrypto -lgssapi_krb5 -lz -lreadline
-lcrypt -ldl -lm
VERSION = PostgreSQL 9.3beta2

postgres@fslaptop:~$ uname -a
Linux fslaptop 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux
On 2013-07-22 13:22:21 +0200, Feike Steenbergen wrote:
> While testing the 9.3 beta I am unable to get the view definition for
> some views.
> Because of this I cannot use pg_dump to create a valid dump of the
> specified database.

Any chance you can post a schema only dump from 9.2 that reproduces the
problem when loaded into 9.3?

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services
the attached dump can be loaded and results in an error message when
retrieving the view definitions.

On Mon, Jul 22, 2013 at 2:04 PM, Feike Steenbergen
<feikesteenbergen@gmail.com> wrote:
> I can reproduce it with the attached dump.
>
>
>
> On Mon, Jul 22, 2013 at 1:26 PM, Andres Freund <andres@2ndquadrant.com> wrote:
>> only

Attachment
Feike Steenbergen <feikesteenbergen@gmail.com> writes:
> the attached dump can be loaded and results in an error message when
> retrieving the view definitions.

Thanks for the test case.  It looks like I broke this in commit
2ffa740b, as a result of believing the comment in parsenodes.h that says
joinaliasvars lists can only contain Vars or COALESCE expressions :-(.
Will fix.

            regards, tom lane