Received: from citrus.citr.uq.oz.au (citrus.citr.com.au [130.102.53.8]) by hub.org (8.8.8/8.7.5) with ESMTP id TAA19543 for ; Wed, 26 Aug 1998 19:34:50 -0400 (EDT) Received: from orange.citr.com.au (orange [130.102.76.2]) by citrus.citr.uq.oz.au (8.8.4/8.8.8) with ESMTP id JAA28414 for ; Thu, 27 Aug 1998 09:33:45 +1000 (EST) X-Authentication-Warning: citrus.citr.uq.oz.au: nobody owned process doing -bs Received: from guava.citr.com.au (guava [130.102.76.14]) by orange.citr.com.au (8.8.8/8.8.8) with ESMTP id JAA21000; Thu, 27 Aug 1998 09:34:42 +1000 (EST) From: Pushkar Piggott Received: (from pkp@localhost) by guava.citr.com.au (8.8.8/8.8.8) id JAA07554; Thu, 27 Aug 1998 09:34:41 +1000 (EST) Message-Id: <199808262334.JAA07554@guava.citr.com.au> Subject: Bug in GROUP BY for INSERT To: pgsql-sql@postgresql.org Date: Thu, 27 Aug 1998 09:34:41 +1000 (EST) Cc: symons@citr.com.au (Anthony Symons) X-Mailer: ELM [version 2.4 PL25] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit The following is surely not the intended operation: createdb pkptest psql pkptest Welcome to the POSTGRESQL interactive sql monitor: Please read the file COPYRIGHT for copyright terms of POSTGRESQL type \? for help on slash commands type \q to quit type \g or terminate with semicolon to execute query You are currently connected to the database: pkptest pkptest=> CREATE TABLE a_foo (a_Index int4, pkptest-> bar int4); CREATE pkptest=> INSERT INTO a_foo pkptest-> VALUES (1, 1); INSERT 252074 1 pkptest=> INSERT INTO a_foo pkptest-> VALUES (2, 1); INSERT 252075 1 pkptest=> CREATE TABLE b_foo (b_Index int4, pkptest-> count int4); CREATE pkptest=> INSERT INTO b_foo pkptest-> SELECT a_Index, COUNT(*) pkptest-> FROM a_foo pkptest-> GROUP BY a_Index; ERROR: The field being grouped by must appear in the target list pkptest=> INSERT INTO b_foo pkptest-> SELECT a_Index, COUNT(*) pkptest-> FROM a_foo pkptest-> GROUP BY b_Index; INSERT 0 2 cheers Pushkar -- ------------------------------------------------------------------------------ Dr Pushkar Piggott | | Phone: +61-7-3259-2369 CiTR Pty Ltd | Fax: +61-7-3259-2259 John Oxley Centre | 339 Coronation Drive | Email: p.piggott@citr.com.au MILTON | QLD 4064 AUSTRALIA | Postal: PO Box 1643 ------------------------------------------------------------------------------