Re: pg_generate_sequence and info_schema patch (Was: SELECT Question)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Kris Jurka <books(at)ejurka(dot)com>, Alex <alex(at)meerkatsoft(dot)com>, "Lada 'Ray' Lostak" <ray(at)unreal64(dot)net>, pgsql-patches(at)postgresql(dot)org
Subject: Re: pg_generate_sequence and info_schema patch (Was: SELECT Question)
Date: 2004-02-01 05:00:26
Message-ID: 12141.1075611626@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

Joe Conway <mail(at)joeconway(dot)com> 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2004-02-01 05:56:19 Does SET STATISTICS lock the table?
Previous Message Doug McNaught 2004-02-01 04:41:54 Re: Are there commands to enquire about table structure?

Browse pgsql-patches by date

  From Date Subject
Next Message Dennis Bjorklund 2004-02-01 07:52:11 reading uninitialized buffer
Previous Message Joe Conway 2004-02-01 04:31:00 pg_generate_sequence and info_schema patch (Was: SELECT Question)