Skip site navigation (1) Skip section navigation (2)

Accessing an array element from a function

From: Mike Nolan <nolan(at)gw(dot)tssi(dot)com>
To: pgsql-general(at)postgresql(dot)org (pgsql general list)
Subject: Accessing an array element from a function
Date: 2004-09-30 22:23:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
This may be mostly a documention issue:

I have a function with two parameters that returns an array: text[].

I want to access just the first element of that array within 
my SQL statement.

This doesn't work:

    select myfunc(1,2)[1];    

This does work:
    select (myfunc(1,2)[1];

If that's how it's supposed to work, is that documented somewhere?
Mike Nolan


pgsql-general by date

Next:From: Scott FrankelDate: 2004-09-30 22:31:18
Subject: readline install questions
Previous:From: Tom LaneDate: 2004-09-30 21:48:10
Subject: Re: about "pg_dump " without pompt password

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group