Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 3CF0D6FED3 for ; Tue, 19 Jun 2012 17:21:21 -0300 (ADT) Received: from mail-qa0-f52.google.com ([209.85.216.52]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Sh4vO-00013T-OO for pgsql-bugs@postgresql.org; Tue, 19 Jun 2012 20:21:20 +0000 Received: by qabj34 with SMTP id j34so3299193qab.11 for ; Tue, 19 Jun 2012 13:21:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=pyFqXrdD9CmzhsDuhmAUy0ny/PaJ0kVzDs4J11T9wFo=; b=PJerxi6pbWEOtLsOW099tuE/fTY3XMCuFkGMwlxp5B+B+48ELFcei7pDT+w+LT8wwC h5V1lIqcvCGhrQRqp7NEA0+Y6Pr07KT0WIXerEsX/TxbR24IpJ1Rv7zSB6mgxx29fdsD dvUxXPM2vb8RQ6NPNT2763Dw5r6XXi4yUUQvElWlnIj/4kT24suCjcMaFCiaPgbZcysY gmYuwGdv0NRAQKZGdyzIg2RCCu3cEH0oHvAQejlJwxOcMc/E90T4znxtYwSoHtmQ1reT c/n07euPKkimk67YBH7kzn74xsjtwMK3yC/gomgUW2oQ35OfOh5M8wnrmbtIZPN1yu8H Tkrw== Received: by 10.224.179.6 with SMTP id bo6mr717858qab.17.1340137264258; Tue, 19 Jun 2012 13:21:04 -0700 (PDT) Received: from llserver.lakeliving.com (ool-18bbd2c6.static.optonline.net. [24.187.210.198]) by mx.google.com with ESMTPS id n2sm50597089qap.10.2012.06.19.13.21.02 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 19 Jun 2012 13:21:03 -0700 (PDT) Date: Tue, 19 Jun 2012 16:20:58 -0400 From: Ryan Kelly To: joe@tanga.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6699: pg_restore with -j -- doesn't restore view that groups by primary key Message-ID: <20120619202058.GA7792@llserver.lakeliving.com> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="M9NhX3UHpAaciwkO" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.3 (--) X-Archive-Number: 201206/163 X-Sequence-Number: 33390 --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 19, 2012 at 07:49:20PM +0000, joe@tanga.com wrote: > The following bug has been logged on the website: > > Bug reference: 6699 > Logged by: Joe Van Dyk > Email address: joe@tanga.com > PostgreSQL version: 9.1.4 > Operating system: OSX > Description: > > $ pg_restore -O -j 4 ~/tanga.dump -d tanga_dev_full_backup > > pg_restore: [archiver (db)] Error while PROCESSING TOC: > pg_restore: [archiver (db)] Error from TOC entry 417; 1259 66296 VIEW > site_channels monkey > pg_restore: [archiver (db)] could not execute query: ERROR: column > "channels.start_at" must appear in the GROUP BY clause or be used in an > aggregate function > LINE 2: SELECT channels.id, channels.start_at, channels.end_at, ... > ^ > Command was: CREATE VIEW site_channels AS > SELECT channels.id, channels.start_at, channels.end_at, channels.title, > channels.descriptio... > > > > site_channels view definition: > > 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. > > > -- > Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-bugs -Ryan --M9NhX3UHpAaciwkO Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="gistfile1.txt" $ cat t.sql create table foo (id serial primary key, name text); insert into foo (name) values ('joe'); create view v as (select id, name from foo group by id); $ createdb test $ psql -f t.sql test psql:t.sql:1: NOTICE: CREATE TABLE will create implicit sequence "foo_id_seq" for serial column "foo.id" psql:t.sql:1: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "foo_pkey" for table "foo" CREATE TABLE INSERT 0 1 CREATE VIEW $ pg_dump -Fc test > t.dump $ dropdb test $ createdb test $ pg_restore -j4 -d test t.dump pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 163; 1259 3870794 VIEW v joe pg_restore: [archiver (db)] could not execute query: ERROR: column "foo.name" must appear in the GROUP BY clause or be used in an aggregate function LINE 2: SELECT foo.id, foo.name FROM foo GROUP BY foo.id; ^ Command was: CREATE VIEW v AS SELECT foo.id, foo.name FROM foo GROUP BY foo.id; pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.v" does not exist Command was: ALTER TABLE public.v OWNER TO joe; WARNING: errors ignored on restore: 2 --M9NhX3UHpAaciwkO--