Re: pg_upgrade failed if view contain natural left join condition
Thom Brown <thom@linux.com>
From: Thom Brown <thom@linux.com>
To: tushar <tushar.ahuja@enterprisedb.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2017-07-20T12:46:51Z
Lists: pgsql-hackers
On 20 July 2017 at 13:09, tushar <tushar.ahuja@enterprisedb.com> wrote:
> Steps to reproduce -
>
> v9.6
>
> postgres=# create table t(n int);
> CREATE TABLE
> postgres=# create table t1(a int);
> CREATE TABLE
> postgres=# create view ttt1 as SELECT e.n FROM t e NATURAL LEFT JOIN t1 d;
> CREATE VIEW
>
> v10 -
>
> run pg_upgrade -
>
> going to fail ,with this error -
>
> "
> pg_restore: creating TABLE "public.t"
> pg_restore: creating TABLE "public.t1"
> pg_restore: creating VIEW "public.ttt1"
> pg_restore: [archiver (db)] Error while PROCESSING TOC:
> pg_restore: [archiver (db)] Error from TOC entry 187; 1259 16390 VIEW ttt1
> edb
> pg_restore: [archiver (db)] could not execute query: ERROR: syntax error at
> or near ")"
> LINE 16: LEFT JOIN "t1" "d");
> ^
> Command was:
> -- For binary upgrade, must preserve pg_type oid
> SELECT
> pg_catalog.binary_upgrade_set_next_pg_type_oid('16392'::pg_catalog.oid);
>
>
> -- For binary upgrade, must preserve pg_type array oid
> SELECT
> pg_catalog.binary_upgrade_set_next_array_pg_type_oid('16391'::pg_catalog.oid);
>
>
> -- For binary upgrade, must preserve pg_class oids
> SELECT
> pg_catalog.binary_upgrade_set_next_heap_pg_class_oid('16390'::pg_catalog.oid);
>
> CREATE VIEW "ttt1" AS
> SELECT "e"."n"
> FROM ("t" "e"
> LEFT JOIN "t1" "d");
>
> "
> I think -this issue should be there in the older branches as well but not
> checked that.
I get the same result on 9.2 and 10 in pg_dump output.
Thom
Commits
-
Doc: clarify description of degenerate NATURAL joins.
- 80af818dd618 9.2.22 landed
- a6088e1f5a58 9.3.18 landed
- 769eaef7600b 9.4.13 landed
- 315ca7ffb909 9.5.8 landed
- 5512427b19e7 9.6.4 landed
- ed3dc224e5aa 10.0 landed
-
Fix dumping of outer joins with empty qual lists.
- eb145fdfea91 10.0 landed
- e947838ae432 9.3.18 landed
- c2bbec9f2b36 9.5.8 landed
- 6ab4a1136ed9 9.4.13 landed
- 41ada8377492 9.6.4 landed