Re: Arrays: determining size

From: SZUCS Gábor <surrano(at)mailbox(dot)hu>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Arrays: determining size
Date: 2002-12-02 18:48:13
Message-ID: 017601c29a33$5e894820$0a03a8c0@fejleszt2
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve,

It worked for me in 7.2.1:

select *, array_dims(bar) from foo;
bar | array_dims
-----------+------------
{1,2,3,4} | [1:4]
{a,b,c} | [1:3]
(2 rows)

I think it's two-dimensional; read more in arrays.html in the PostgreSQL
doc.

G.
--
while (!asleep()) sheep++;

---------------------------- cut here ------------------------------
----- Original Message -----
From: "Steve Crawford" <scrawford(at)pinpointresearch(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Sent: Monday, December 02, 2002 6:58 PM
Subject: [GENERAL] Arrays: determining size

> Given a variable length array data type in a table:
> create table foo (bar text[]);
>
> and some data:
> insert into foo values ('{"a","b","c"'});
> insert into foo values ('{"1","2","3","4"}');
>
> Is there a simple way to determe the size of each array?
>
> Cheers,
> Steve
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nicolai Tufar 2002-12-02 18:54:02 Re: timing queries?
Previous Message Joel Burton 2002-12-02 18:38:27 Re: [SQL] CURRENT_TIMSTAMP