How can you expand a “condensed” PostgreSQL row into separate columns?

前端 未结 2 1296
逝去的感伤
逝去的感伤 2020-12-15 21:02

I have a function which returns a table.

If you run SELECT * FROM some_function(12345) the result is:

object_id | name
----------------
         


        
2条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-15 21:58

    SELECT * FROM (SELECT some_function(thing_id) FROM things) x;
    

    The subselect SELECT some_function(thing_id) FROM things returns a row for each record found. The outer select "uncompresses" the row into separate columns.

提交回复
热议问题