pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Grant <grant@conprojan.com.au>
To: pgsql-sql@postgresql.org
Subject: How to count elements in an array?
Date: Tue, 6 Mar 2001 08:49:52 +1000 (EST)
Message-ID: <Pine.LNX.4.21.0103060849160.2044-100000@webster.conprojan.com.au> (raw)

How can I obtain a count (number) of elements in a text array? Thanks.

test=# \d array
                              Table "array"
  Attribute   |  Type   |                    Modifier
--------------+---------+------------------------------------------------
 id           | integer | not null default nextval('array_id_seq'::text)
 to_group_ids | text[]  |
Index: array_pkey

test=#

--- EXAMPLE SELECT ---

test=# select to_group_ids[1] from array where id=1;
 to_group_ids
--------------
 1
(1 row)

test=#




view thread (2+ messages)  latest in thread

Message-ID: <Pine.LNX.4.21.0103060849160.2044-100000@webster.conprojan.com.au>
Permalink:  ../Pine.LNX.4.21.0103060849160.2044-100000@webster.conprojan.com.au/
Also on:    postgresql.org/message-id/Pine.LNX.4.21.0103060849160.2044-100000@webster.conprojan.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: grant@conprojan.com.au
  Subject: Re: How to count elements in an array?
  In-Reply-To: <Pine.LNX.4.21.0103060849160.2044-100000@webster.conprojan.com.au>
  References: <Pine.LNX.4.21.0103060849160.2044-100000@webster.conprojan.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