pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Mr M Pacey <M.Pacey@liverpool.ac.uk>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Arrays and count()
Date: Tue, 27 Apr 1999 11:07:32 -0400
Message-ID: <8505.925225652@sss.pgh.pa.us> (raw)
In-Reply-To: <3725C3E8.18B0@liverpool.ac.uk>

Mr M Pacey <M.Pacey@liverpool.ac.uk> writes:
> select sentence.tags[1], count (*) from sentence group by
> sentence.tags[1];

> Which fails to parse.

Yes, I get 'Illegal use of aggregates or non-group column in target
list' with current sources.  Without having looked, my guess is that
the system is too dumb to realize that the same array element is being
named at both places (ie, it's not exploiting the fact that the
subscripts are constant).  Not sure how hard this might be to fix.

> select count (sentence.tags[1]) from sentence;
> PQexec() -- Request was sent to backend, but backend closed the channel
> before responding.

Still crashes in 6.5-current :-(.  Will look into it.

As a workaround, you could probably select the tag data into a temporary
table and then do the group by on the temp table...

			regards, tom lane



view thread (3+ messages)

Message-ID: <8505.925225652@sss.pgh.pa.us>
Permalink:  ../8505.925225652@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/8505.925225652@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, M.Pacey@liverpool.ac.uk
  Subject: Re: [SQL] Arrays and count()
  In-Reply-To: <8505.925225652@sss.pgh.pa.us>
  References: <3725C3E8.18B0@liverpool.ac.uk> <8505.925225652@sss.pgh.pa.us>

* 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