Search Postgresql Archives

Set returning functions in the SELECT list

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

 



I have a question about the behavior of SRFs in the SELECT list.
Consider the following example:

select
    generate_series(1,2),
    generate_series(1,2)
;

And its output:

 generate_series | generate_series 
-----------------+-----------------
               1 |               1
               2 |               2

And then this example:

select
    generate_series(1,2),
    generate_series(1,3)
;

 generate_series | generate_series 
-----------------+-----------------
               1 |               1
               2 |               2
               1 |               3
               2 |               1
               1 |               2
               2 |               3

My question is "why?" I actually expected the second behavior in both
cases. Also, I'm not sure where this difference in behavior is
documented. I looked at:
http://www.postgresql.org/docs/current/static/xfunc-sql.html#XFUNC-SQL-FUNCTIONS-RETURNING-SET
but it doesn't seem to be explicitly mentioned there.

And yes, I understand doing this is deprecated and my results would
probably be better achieved with LATERAL when 9.3 comes out.

-Ryan Kelly


-- 
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