multiple SRFs in SELECT clause.

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема multiple SRFs in SELECT clause.
Дата
Msg-id Pine.BSO.4.64.0611270549540.13818@leary2.csoft.net
обсуждение исходный текст
Ответы Re: multiple SRFs in SELECT clause.
Список pgsql-bugs
I'm getting some odd results when running two generate_series calls in a
SELECT.  When the two calls return the same number of rows you get that
many rows out:

# SELECT generate_series(1,3), generate_series(1,3);
  generate_series | generate_series
-----------------+-----------------
                1 |               1
                2 |               2
                3 |               3
(3 rows)

When the row counts differ you get the least common multiple number of
rows.

# SELECT generate_series(1,4), generate_series(1,2);
  generate_series | generate_series
-----------------+-----------------
                1 |               1
                2 |               2
                3 |               1
                4 |               2
(4 rows)

I was personally expecting a cross join between them that would be
equivalent to

# SELECT * FROM generate_series(1,4) a, generate_series(1,2) b;
  a | b
---+---
  1 | 1
  1 | 2
  2 | 1
  2 | 2
  3 | 1
  3 | 2
  4 | 1
  4 | 2
(8 rows)

Tested on 8.1.3 and CVS HEAD.

Kris Jurka

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

Предыдущее
От: "Thomas H."
Дата:
Сообщение: Re: 8.2rc1: vacuum full fills up disk space
Следующее
От: "Jeremy Haile"
Дата:
Сообщение: fsync and semctl errors with 8.1.5/win32