Thread: Question about undefinably query...

Question about undefinably query...

From
"A. Kretschmer"
Date:
Hi all,

there was a question on #postgresql (irc-channel) from CyberDuck without
an answer. A little example:

test=*# select generate_series(1,5), generate_series(6,10) order by 1;generate_series | generate_series
-----------------+-----------------              1 |               6              2 |               7              3 |
            8              4 |               9              5 |              10
 
(5 rows)

test=*# select generate_series(1,5), generate_series(7,10) order by 1;generate_series | generate_series
-----------------+-----------------              1 |               7              1 |               8              1 |
            9              1 |              10              2 |               8              2 |               9
     2 |              10              2 |               7              3 |               9              3 |
10              3 |               7              3 |               8              4 |              10              4 |
            7              4 |               8              4 |               9              5 |               7
     5 |               8              5 |               9              5 |              10
 
(20 rows)

Why returns the first select 5 rows (i think, this is okay) and the 2nd
20 rows?

Version is a 8.1 on Debian.



Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net


Re: Question about undefinably query...

From
Tom Lane
Date:
"A. Kretschmer" <andreas.kretschmer@schollglas.com> writes:
> there was a question on #postgresql (irc-channel) from CyberDuck without
> an answer. A little example:

Multiple SRFs in a targetlist behave, um, strangely.  I think the rule
is that all are cycled until they all chance to report "done" at the
same time, so the number of result rows is the least common multiple
of the period lengths.

This is one of the reasons that SRF-in-targetlist is deprecated ...
        regards, tom lane