Re: BUG #7658: the result of pg_get_viewdef can NOT execute directly

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #7658: the result of pg_get_viewdef can NOT execute directly
Дата
Msg-id 24458.1352923063@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #7658: the result of pg_get_viewdef can NOT execute directly  (zoulx1982@163.com)
Список pgsql-bugs
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=11e131854f8231a21613f834c40fe9d046926387
--- 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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: limkimhuot
Дата:
Сообщение: Re: BUG #7628: Installation of PostgreSQL 9.2.1 on Windows 7 may take too long
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #7657: Create Table doesn't create columns