Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 472266FED3 for ; Tue, 19 Jun 2012 17:58:19 -0300 (ADT) Received: from 30.55.colo.spiretech.net ([69.168.55.30] helo=lists.commandprompt.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sh5VB-0001cq-Df for pgsql-bugs@postgresql.org; Tue, 19 Jun 2012 20:58:18 +0000 Received: from perhan.alvh.no-ip.org (spinlock.commandprompt.com [69.168.55.30]) by lists.commandprompt.com (Postfix) with ESMTPA id 5633CE3; Tue, 19 Jun 2012 13:58:03 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([200.126.80.85] helo=perhan.alvh.no-ip.org) by assp.commandprompt.com with ESMTPS(AES256-SHA) (2.1.1); 19 Jun 2012 13:58:00 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 8CBC96E3F9; Tue, 19 Jun 2012 16:57:53 -0400 (CLT) Content-Type: text/plain; charset=UTF-8 Cc: joe , Pg Bugs Subject: Re: BUG #6699: pg_restore with -j -- doesn't restore view that groups by primary key From: Alvaro Herrera To: Ryan Kelly In-reply-to: <20120619202058.GA7792@llserver.lakeliving.com> References: <20120619202058.GA7792@llserver.lakeliving.com> Date: Tue, 19 Jun 2012 16:57:53 -0400 Message-Id: <1340139400-sup-7121@alvh.no-ip.org> User-Agent: Sup/git X-Assp-Version: 2.1.1(11364) on assp.commandprompt.com X-Assp-Client-TLS: yes X-Assp-ID: assp.commandprompt.com m1-39483-10386 X-Assp-Envelope-From: alvherre@alvh.no-ip.org X-Assp-Intended-For: rpkelly22@gmail.com X-Assp-Original-Subject: Re: [BUGS] BUG #6699: pg_restore with -j -- doesn't restore view that groups by primary key Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/164 X-Sequence-Number: 33391 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@tanga.com wrote: > > View definition: > > SELECT channels.id, channels.start_at, channels.end_at, channels.tit= le > > FROM channels > > LEFT JOIN channels_products cp ON cp.channel_id =3D channels.id > > LEFT JOIN buyable_products bp ON bp.id =3D cp.product_id > > GROUP BY channels.id; > >=20 > > channels.id is a primary key. >=20 > 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. --=20 =C3=81lvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support