From: Tom Lane <tgl@sss.pgh.pa.us>
To: zoulx1982@163.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7658: the result of pg_get_viewdef can NOT execute directly
Date: Wed, 14 Nov 2012 14:57:43 -0500
Message-ID: <24458.1352923063@sss.pgh.pa.us> (raw)
In-Reply-To: <E1TYXMO-00036L-6u@wrigleys.postgresql.org>
References: <E1TYXMO-00036L-6u@wrigleys.postgresql.org>
zoulx1982@163.com writes:
> postgres=# create table t1(a int, b int);
> CREATE TABLE
> postgres=# create table t2(c int, d int);
> CREATE TABLE
> postgres=# create view v as select * from t1 t where a in (select a from t2
> t);
> CREATE VIEW
> postgres=# 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)
This is fixed in HEAD as a consequence of commit
http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=11e131854f8231a21613f834c4...
--- I get
SELECT t.a, t.b FROM t1 t WHERE (t.a IN (SELECT t.a FROM t2 t_1));
which is a valid representation of the view. At the time we felt it was
not worth the risk of back-patching. I'm still inclined to think that,
since this example doesn't seem to correspond to any real-world use case
(the original query is surely a mistake no?).
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, zoulx1982@163.com
Subject: Re: BUG #7658: the result of pg_get_viewdef can NOT execute directly
In-Reply-To: <24458.1352923063@sss.pgh.pa.us>
References: <E1TYXMO-00036L-6u@wrigleys.postgresql.org> <24458.1352923063@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox