Received: from webster.conprojan.com.au (raw130515-1.gw.connect.com.au [202.21.11.98]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f25Mnvx57075 for ; Mon, 5 Mar 2001 17:49:57 -0500 (EST) (envelope-from grant@conprojan.com.au) Received: (qmail 2115 invoked by uid 523); 5 Mar 2001 22:49:52 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 5 Mar 2001 22:49:52 -0000 Date: Tue, 6 Mar 2001 08:49:52 +1000 (EST) From: Grant To: pgsql-sql@postgresql.org Subject: How to count elements in an array? Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Archive-Number: 200103/74 X-Sequence-Number: 1722 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=#