Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id E7B0E6FED3 for ; Tue, 19 Jun 2012 18:37:53 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sh67T-0002C7-Em for pgsql-bugs@postgresql.org; Tue, 19 Jun 2012 21:37:53 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q5JLbZoM022883; Tue, 19 Jun 2012 17:37:35 -0400 (EDT) From: Tom Lane To: Alvaro Herrera cc: Ryan Kelly , joe , Pg Bugs Subject: Re: BUG #6699: pg_restore with -j -- doesn't restore view that groups by primary key In-reply-to: <1340139400-sup-7121@alvh.no-ip.org> References: <20120619202058.GA7792@llserver.lakeliving.com> <1340139400-sup-7121@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Tue, 19 Jun 2012 16:57:53 -0400" Date: Tue, 19 Jun 2012 17:37:34 -0400 Message-ID: <22882.1340141854@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/165 X-Sequence-Number: 33392 Alvaro Herrera writes: > 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: >>> 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; > 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. Hmm ... check_functional_grouping does add the PK's OID to the query's constraintDeps list. Apparently we're losing that dependency knowledge somewhere between the parser and pg_dump? regards, tom lane