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