Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT

2004-02-07 Thread Christopher Browne
Clinging to sanity, [EMAIL PROTECTED] (Christopher Kings-Lynne) mumbled into her beard: I think you can provide a precise specification without losing simplicity of explanation. Maybe something like When step is positive, zero rows are returned if start stop. Conversely, when step is

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT

2004-02-04 Thread Christopher Kings-Lynne
I think you can provide a precise specification without losing simplicity of explanation. Maybe something like When step is positive, zero rows are returned if start stop. Conversely, when step is negative, zero rows are returned if start stop. It is an error for step to be zero.

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT

2004-02-04 Thread Joe Conway
Christopher Kings-Lynne wrote: Having something that generates a list of dates would be handy, however I guess you can do it with the current series generator by adding that many day intervals to a base date... Seems to work: regression=# select current_date + s.a as dates from

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT

2004-02-04 Thread Gaetano Mendola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Joe Conway wrote: | Tom Lane wrote: | | 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 |

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT

2004-02-04 Thread Joe Conway
Gaetano Mendola wrote: select * from generate_series(5,1,-2); I understood on your past posts that instead this result was obtained with: select * from generate_series(5,1,2); ~ generate_series - - ~ 5 ~ 3 ~ 1 (3 rows) Tom objected to the

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT

2004-02-03 Thread Joe Conway
Tom Lane wrote: BTW, I think I was beating you over the head with an urban legend. Some idle googling revealed the true facts of the Mariner failure: http://www.rchrd.com/Misc-Texts/Famous_Fortran_Errors Oh well, I've been beat over the head with worse things, at least metaphorically ;-).

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT Question)

2004-02-03 Thread Tom Lane
Joe Conway [EMAIL PROTECTED] writes: A first shot at documentation for generate_series() is available here in html form: http://www.joeconway.com/functions-srf.html Feedback welcome. This bit seems unnecessarily vague: Depending on the requested combination of start, stop, and step, it

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT Question)

2004-02-02 Thread Tom Lane
Joe Conway [EMAIL PROTECTED] writes: Tom Lane wrote: folklore has it that Mariner II was lost to exactly such a bug). Ouch -- got the point. BTW, I think I was beating you over the head with an urban legend. Some idle googling revealed the true facts of the Mariner failure:

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT

2004-02-01 Thread Joe Conway
Tom Lane wrote: 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. OK -- for this and

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT Question)

2004-02-01 Thread Tom Lane
Joe Conway [EMAIL PROTECTED] writes: Tom Lane wrote: 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

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT

2004-02-01 Thread Joe Conway
Tom Lane wrote: folklore has it that Mariner II was lost to exactly such a bug). Ouch -- got the point. If you want to allow the 3-parameter form to specify a negative step size, that's fine. But don't use a heuristic to guess the intended step direction. The attached patch implements the

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT Question)

2004-02-01 Thread Tom Lane
Joe Conway [EMAIL PROTECTED] writes: The one corner case not discussed is a step size of zero. Currently it returns zero rows, but I considered having it generate an ERROR. I'd go for ERROR --- can't think of any reason to do otherwise, nor any standard programming language that wouldn't

Re: [PATCHES] pg_generate_sequence and info_schema patch (Was: SELECT Question)

2004-01-31 Thread Tom Lane
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