Re: Arrays

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Bob Pawley <rjpawley(at)shaw(dot)ca>
Cc: Postgresql <pgsql-general(at)postgresql(dot)org>
Subject: Re: Arrays
Date: 2011-09-14 18:05:08
Message-ID: CAFcNs+oY_D5LM5B+Kn+jG_+Skf8Wzj3eaQM5X-cb=XPEg-MnYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

2011/9/14 Bob Pawley <rjpawley(at)shaw(dot)ca>

> Hi
>
> Is there a method of counting the number of elements in an array??
>
>

Yes...

Use function array_upper [1].

See an example:

postgres(at)bdteste=# SELECT array_upper(ARRAY['foo', 'bar'], 1);
array_upper
-------------
2
(1 row)

[1] http://www.postgresql.org/docs/current/interactive/functions-array.html
--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Blog sobre TI: http://fabriziomello.blogspot.com
>> Perfil Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello

In response to

  • Arrays at 2011-09-14 18:01:09 from Bob Pawley

Responses

  • Re: Arrays at 2011-09-14 18:09:27 from Merlin Moncure

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2011-09-14 18:09:27 Re: Arrays
Previous Message Bob Pawley 2011-09-14 18:01:09 Arrays