Search Postgresql Archives

Re: element from an array by its index

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 21, 2009 at 04:08:51PM +0600, Murat Kabilov wrote:
> I would like to know if there is a function that extracts an element by its
> index from an array?

No, the syntax most people expect and use would be arr[ndx].  If you
want a function, it would be easy to do:

  CREATE FUNCTION array_index(anyarray,int)
      RETURNS anyelement IMMUTABLE
      LANGUAGE sql AS $$
    SELECT $1[$2]; $$;

-- 
  Sam  http://samason.me.uk/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux