What is the expected behaviour for multiple set-returning functions in SELECT clause?
<p>I'm trying to get a "cross join" with the result of two set-returning functions, but in some cases I don't get the "cross join", see example</p>

<p><strong>Behaviour 1</strong>: When set lenghts are the same, it matches item by item from each set</p>

<pre>
postgres=# SELECT generate_series(1,3), generate_series(5,7) order by 1,2;
 generate_series | generate_series 
-----------------+-----------------
               1 |               5
               2 |               6
               3 |               7
(3 rows)
</pre>

<p><strong>Behaviour 2</strong>: When set lenghts are different, it "cross join"s the sets</p>

<pre>
postgres=# SELECT generate_series(1,2), generate_series(5,7) order by 1,2;
 generate_series | generate_series 
-----------------+-----------------
               1 |               5
               1 |               6
               1 |               7
               2 |               5
               2 |               6
               2 |               7
(6 rows)
</pre>

<p>I think I'm not understanding something here, can someone explain the expeted behaviour?</p>

<p>Another example, even weirder:</p>

<pre>
postgres=# SELECT generate_series(1,2) x, generate_series(1,4) y order by x,y;
 x | y 
---+---
 1 | 1
 1 | 3
 2 | 2
 2 | 4
(4 rows)
</pre>

<p>I am looking for an answer to the question in the title, ideally with link(s) to documentation.</p>