Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading parameter name in generate_series function #6606

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

Misleading parameter name in generate_series function #6606

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working MAL/M5 minor

Comments

@monetdb-team
Copy link

Date: 2018-05-22 10:26:37 +0200
From: @swingbit
To: MonetDB5 devs <>
Version: 11.27.13 (Jul2017-SP4)
CC: martin.van.dinther, @njnes

Last updated: 2018-08-31 13:23:09 +0200

Comment 26461

Date: 2018-05-22 10:26:37 +0200
From: @swingbit

User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36
Build Identifier:

The general form of the generate_series function (in all the integer-size variants) is:

create function sys.generate_series(first int, last int, stepsize int)

Parameters "first" and "last" obviously suggest that the series is from "first" to "last" included.

But it actually is from "first" to ("last" - 1)

sql>select * from sys.generate_series(1,5,1);
+-------+
| value |
+=======+
| 1 |
| 2 |
| 3 |
| 4 |
+-------+
4 tuples (1.241ms)

It looks to me like actually generating all numbers from "first" to "last" was the initially intended behaviour - I can't think why one would want to complicate function parameters this way intentionally. A "=" probably slipped off the condition in the loop during implementation. However changing that now would break backward compatibility.

Reproducible: Always

Comment 26475

Date: 2018-06-01 19:30:53 +0200
From: Martin van Dinther <<martin.van.dinther>>

I agree it should behave similar to Postgresql Series Generating Functions:
https://www.postgresql.org/docs/9.6/static/functions-srf.html

Comment 26594

Date: 2018-08-08 15:17:38 +0200
From: MonetDB Mercurial Repository <>

Changeset e63096367379 made by Sjoerd Mullender sjoerd@acm.org in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=e63096367379

Changeset description:

Changed parameter name from "last" to "limit".
This should alleviate bug #6606.

Comment 26606

Date: 2018-08-28 09:42:37 +0200
From: @sjoerdmullender

The confusion was (hopefully) taken away by changing the name of the parameter.
Many such generators go from start up to, but not including finish, so it's not so strange to that here as well. Although I also see the merit of aligning with PostgreSQL.
Let's make it a different bug if we really want to change the semantics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working MAL/M5 minor
Projects
None yet
Development

No branches or pull requests

2 participants