Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6530135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T09:43:08+00:00 2026-05-25T09:43:08+00:00

Essentially, what I want to do is: SELECT set_returning_func(id) FROM my_table; However, the result

  • 0

Essentially, what I want to do is:

SELECT set_returning_func(id) FROM my_table;

However, the result will be a single column in record syntax, e.g.

             set_returning_func              
---------------------------------------------
 (old,17,"August    2, 2011 at 02:54:59 PM")
 (old,28,"August    4, 2011 at 08:03:12 AM")
(2 rows)

I want it to be unpacked into columns. If I write the query this way instead:

SELECT srf.* FROM my_table, set_returning_func(my_table.id);

I get an error message:

ERROR:  function expression in FROM cannot refer to other relations of same query level

How, then, do I get a result set, while also supplying the set-returning function with an argument?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T09:43:09+00:00Added an answer on May 25, 2026 at 9:43 am

    The syntax I was looking for is:

    SELECT (set_returning_func(id)).* FROM my_table;
    

    Details

    set_returning_func(id) is of composite type. Just as the * syntax can be used on tables:

    SELECT my_table.* FROM my_table, my_other_table
    

    It can also be used on composite values (though they must be wrapped in parentheses). Intuitively, one can also select individual columns from a composite-returning function:

    SELECT (set_returning_func(id)).time FROM my_table;
    

    Some set-returning functions have a scalar rather than composite return type. In these cases, the (expr).* syntax doesn’t make sense, and produces an error:

    > SELECT (generate_series(1,5)).*;
    ERROR:  type integer is not composite
    

    The correct syntax is simply:

    > SELECT generate_series(1,5);
     generate_series 
    -----------------
                   1
                   2
                   3
                   4
                   5
    (5 rows)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I essentially want to spider my local site and create a list of all
Essentially I want to know if in VB.NET 2005 if using a sqlcommand and
We have a reverse proxy here, running Apache in version 2.2.x Essentially I want
Essentially what I want to do is to apply additional CSS classes to individual
If I want to essentially grep every line ever in the repository, is there
I want to write a piece of software which is essentially a regex data
Essentially, what I want to do (in DirectX) is to take two partially-transparent images
I want to store a list of numbers (essentially, a set in mathematical terms)
I want to implement a view in an iPhone application that is essentially like
I hava a CSV file that I want to treat as source code. Essentially

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.