Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 23rd, 2005, 02:22 AM
Mike Nolan
Guest
 
Posts: n/a
Default Accessing an array element from a function

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

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

  #2  
Old November 23rd, 2005, 02:22 AM
Tom Lane
Guest
 
Posts: n/a
Default Re: Accessing an array element from a function

Mike Nolan <nolan@gw.tssi.com> writes:[color=blue]
> This doesn't work:
> select myfunc(1,2)[1];[/color]
[color=blue]
> This does work:
> select (myfunc(1,2)[1];[/color]

I suppose you meant

select (myfunc(1,2))[1];
[color=blue]
> If that's how it's supposed to work, is that documented somewhere?[/color]

http://developer.postgresql.org/docs...s.html#AEN1593

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles