Set returning functions in the SELECT list

Поиск
Список
Период
Сортировка
От Ryan Kelly
Тема Set returning functions in the SELECT list
Дата
Msg-id 20121116141433.GA3716@llserver.lakeliving.com
обсуждение исходный текст
Ответы Re: Set returning functions in the SELECT list
Список pgsql-general
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


В списке pgsql-general по дате отправления: