Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYXMR-0003Zy-Og for pgsql-bugs@postgresql.org; Wed, 14 Nov 2012 07:26:11 +0000 Received: from mahout.postgresql.org ([98.129.198.123]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYXMQ-0002t3-Lw for pgsql-bugs@postgresql.org; Wed, 14 Nov 2012 07:26:11 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TYXMO-0000qw-TL for pgsql-bugs@postgresql.org; Wed, 14 Nov 2012 07:26:10 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1TYXMO-00036L-6u for pgsql-bugs@postgresql.org; Wed, 14 Nov 2012 07:26:08 +0000 Date: Wed, 14 Nov 2012 07:26:08 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #7658: the result of pg_get_viewdef can NOT execute directly To: pgsql-bugs@postgresql.org From: zoulx1982@163.com X-Pg-Spam-Score: -2.1 (--) X-Archive-Number: 201211/68 X-Sequence-Number: 34626 The following bug has been logged on the website: Bug reference: 7658 Logged by: ZouLixian Email address: zoulx1982@163.com PostgreSQL version: 9.2.0 Operating system: Linux Description: = postgres=3D# = postgres=3D# select version(); version = = = ---------------------------------------------------------------------------= --------------------------------- ------- PostgreSQL 9.2.0 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.1.2 20080704 (Asianux 3.0 4.1.2-44), = 64-bit (1 row) postgres=3D# = postgres=3D# create table t1(a int, b int); CREATE TABLE postgres=3D# create table t2(c int, d int); CREATE TABLE postgres=3D# create view v as select * from t1 t where a in (select a from = t2 t); CREATE VIEW postgres=3D# select pg_get_viewdef('v'); pg_get_viewdef = ------------------------------------------------------------------ SELECT t.a, t.b FROM t1 t WHERE (t.a IN (SELECT t.a FROM t2 t)); (1 row) postgres=3D# SELECT t.a, t.b FROM t1 t WHERE (t.a IN (SELECT t.a FROM t2 t)= ); ERROR: column t.a does not exist LINE 1: SELECT t.a, t.b FROM t1 t WHERE (t.a IN (SELECT t.a FROM t2 ... ^ postgres=3D# = postgres=3D#