pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Pushkar Piggott <pkp@citr.com.au>
To: pgsql-sql@postgresql.org
Cc: symons@citr.com.au
Subject: Bug in GROUP BY for INSERT
Date: Thu, 27 Aug 1998 09:34:41 +1000 (EST)
Message-ID: <199808262334.JAA07554@guava.citr.com.au> (raw)

The following is surely not the intended operation:

<pkp@cooloola> createdb pkptest
<pkp@cooloola> 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
------------------------------------------------------------------------------



Message-ID: <199808262334.JAA07554@guava.citr.com.au>
Permalink:  ../199808262334.JAA07554@guava.citr.com.au/
Also on:    postgresql.org/message-id/199808262334.JAA07554@guava.citr.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: pkp@citr.com.au, symons@citr.com.au
  Subject: Re: Bug in GROUP BY for INSERT
  In-Reply-To: <199808262334.JAA07554@guava.citr.com.au>
  References: <199808262334.JAA07554@guava.citr.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox