Re: BUG #6699: pg_restore with -j -- doesn't restore view that groups by primary key

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Ryan Kelly <rpkelly22(at)gmail(dot)com>
Cc: joe <joe(at)tanga(dot)com>, Pg Bugs <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #6699: pg_restore with -j -- doesn't restore view that groups by primary key
Date: 2012-06-19 20:57:53
Message-ID: 1340139400-sup-7121@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


Excerpts from Ryan Kelly's message of mar jun 19 16:20:58 -0400 2012:
> On Tue, Jun 19, 2012 at 07:49:20PM +0000, joe(at)tanga(dot)com wrote:

> > View definition:
> > SELECT channels.id, channels.start_at, channels.end_at, channels.title
> > FROM channels
> > LEFT JOIN channels_products cp ON cp.channel_id = channels.id
> > LEFT JOIN buyable_products bp ON bp.id = cp.product_id
> > GROUP BY channels.id;
> >
> > channels.id is a primary key.
>
> Attached is a test case to reproduce the problem, courtesy of the
> original reporter.

The reason this doesn't work is that the primary key is not defined
until later in the restore process.

I think the fix is to make the view dependant on the primary key in the
dump file.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2012-06-19 21:37:34 Re: BUG #6699: pg_restore with -j -- doesn't restore view that groups by primary key
Previous Message Ryan Kelly 2012-06-19 20:20:58 Re: BUG #6699: pg_restore with -j -- doesn't restore view that groups by primary key