Joe Conway <[EMAIL PROTECTED]> writes:
> regression=# select * from pg_generate_sequence(8, 4);
> ERROR:  finish is less than start

Hm, would it be better just to return an empty set?  Certainly I'd
expect pg_generate_sequence(1,0) to return an empty set with no error.

> regression=# select * from pg_generate_sequence(3,8000000000);
> ERROR:  range of start to finish is too large
> HINT:  start to finish range must be less than 4294967295

Is there a good reason for that restriction?  (I've never thought it was
good design for the SRF API to assume that the number of iterations
could be determined in advance, anyway.)

> I'm not sure if it would be a good thing, or too confusing, to document 
> pg_generate_sequence() on the "Sequence Manipulation Functions" page in 
> the docs. Any opinions on that?

It is *not* a sequence function in the sense used on that page.  I'm not
quite sure where to put it, but don't give people the impression that it
is related to sequence objects.

I was going to say "pg_generate_sequence" is a fine name, but after
thinking about the lack of relation to sequence objects I think we ought
not use "sequence" in the name.  How about "pg_generate_series" or
"pg_generate_set"?  Actually I think you could leave off the pg_ prefix
and just make it generate_series or generate_set.  It's not
Postgres-specific in the same way that, say. pg_get_indexdef is.

Maybe the best documentation answer is to create a new subsection in the
Functions chapter.  This may be our first standard set-returning
function but I bet it will not be the last, so the shortness of the
subsection doesn't bother me.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Reply via email to