pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mr M Pacey <M.Pacey@liverpool.ac.uk>
To: pgsql-sql@postgresql.org
Subject: Arrays and count()
Date: Tue, 27 Apr 1999 15:04:24 +0100
Message-ID: <3725C3E8.18B0@liverpool.ac.uk> (raw)

I'm having difficulties formulating what I thought was a simple
query in 6.3.2. I have a table defined like this:

create table sentence
(
  typenum int4,
  wordpos int4,
  words text[],
  tags  text[]
);

What I'd like to do is, e.g. select all instances of tags[1] and
display the frequency values for each unique (distinct) entry.
The query I tried was:

select sentence.tags[1], count (*) from sentence group by
sentence.tags[1];

Which fails to parse. Trying to work backwards I try constructing a
related command:

select count (sentence.tags[1]) from sentence;

And am treated to the error message:

PQexec() -- Request was sent to backend, but backend closed the channel
before responding.
        This probably means the backend terminated abnormally before or
while processing the request.

Is this a bug, or am I completely failing to understand one or more
of the concepts involved here?

Mike Pacey.



view thread (3+ messages)  latest in thread

Message-ID: <3725C3E8.18B0@liverpool.ac.uk>
Permalink:  ../3725C3E8.18B0@liverpool.ac.uk/
Also on:    postgresql.org/message-id/3725C3E8.18B0@liverpool.ac.uk

 · 

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: M.Pacey@liverpool.ac.uk
  Subject: Re: Arrays and count()
  In-Reply-To: <3725C3E8.18B0@liverpool.ac.uk>
  References: <3725C3E8.18B0@liverpool.ac.uk>

* 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