Wrong parameter names for make_interval (Postgres 13)

Started by Thomas Kellererover 5 years ago5 messagesdocs
Jump to latest
#1Thomas Kellerer
shammat@gmx.net

There is a typo in the parameter names of the make_interval() function.

The parameter names are all defined with plural, not singular as it is shown
in the Postgres 13 manual.

So instead of

make_interval ( [ year int [, month int [, week int [, day int [, hour int [, min int [, sec double precision ]]]]]]] )

it should be

make_interval ( [ years int [, months int [, weeks int [, days int [,hours int [, mins int [, secs double precision ]]]]]]] )

Thomas

#2Pavel Stehule
pavel.stehule@gmail.com
In reply to: Thomas Kellerer (#1)
Re: Wrong parameter names for make_interval (Postgres 13)

po 5. 10. 2020 v 15:56 odesílatel Thomas Kellerer <shammat@gmx.net> napsal:

There is a typo in the parameter names of the make_interval() function.

The parameter names are all defined with plural, not singular as it is
shown
in the Postgres 13 manual.

So instead of

make_interval ( [ year int [, month int [, week int [, day int [, hour
int [, min int [, sec double precision ]]]]]]] )

it should be

make_interval ( [ years int [, months int [, weeks int [, days int
[,hours int [, mins int [, secs double precision ]]]]]]] )

this syntax is not correct too

It should be

make_interval( years int default 0, month int default 0, days int
default 0, hours int default 0, secs double precision default 0)

Regards

Pavel

Show quoted text

Thomas

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Pavel Stehule (#2)
Re: Wrong parameter names for make_interval (Postgres 13)

Pavel Stehule <pavel.stehule@gmail.com> writes:

po 5. 10. 2020 v 15:56 odesílatel Thomas Kellerer <shammat@gmx.net> napsal:

So instead of
make_interval ( [ year int [, month int [, week int [, day int [, hour
int [, min int [, sec double precision ]]]]]]] )
it should be
make_interval ( [ years int [, months int [, weeks int [, days int
[,hours int [, mins int [, secs double precision ]]]]]]] )

Right, fixed.

this syntax is not correct too
It should be
make_interval( years int default 0, month int default 0, days int
default 0, hours int default 0, secs double precision default 0)

IIRC, I intentionally changed that in v13; the existence of the defaults
is sufficiently covered by the text "... fields, each of which can default
to zero". I think that was partly motivated by trying to get the function
signature to fit into limited space. The final docs-table design we ended
up with might allow undoing it, but I don't see any real reason to. The
other way is more verbose and not any clearer.

I spent a little bit of time scanning for other discrepancies between
func.sgml and pg_proc.proargnames, and found several, mostly though
not exclusively in the JSON functions. In these other cases, though,
I think there might be a good argument for making pg_proc fit the docs
not the other way around. In the JSON functions, for example, pg_proc
randomly has some functions calling the main JSON[B] input "target"
while others call it "from_json" or "json_in". I'm not real sure
which of those names is preferable, but inconsistency is not preferable.

regards, tom lane

#4Pavel Stehule
pavel.stehule@gmail.com
In reply to: Tom Lane (#3)
Re: Wrong parameter names for make_interval (Postgres 13)

po 5. 10. 2020 v 17:53 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

Pavel Stehule <pavel.stehule@gmail.com> writes:

po 5. 10. 2020 v 15:56 odesílatel Thomas Kellerer <shammat@gmx.net>

napsal:

So instead of
make_interval ( [ year int [, month int [, week int [, day int [, hour
int [, min int [, sec double precision ]]]]]]] )
it should be
make_interval ( [ years int [, months int [, weeks int [, days int
[,hours int [, mins int [, secs double precision ]]]]]]] )

Right, fixed.

this syntax is not correct too
It should be
make_interval( years int default 0, month int default 0, days int
default 0, hours int default 0, secs double precision default 0)

IIRC, I intentionally changed that in v13; the existence of the defaults
is sufficiently covered by the text "... fields, each of which can default
to zero". I think that was partly motivated by trying to get the function
signature to fit into limited space. The final docs-table design we ended
up with might allow undoing it, but I don't see any real reason to. The
other way is more verbose and not any clearer.

I don't understand,

the syntax [ a [, b]] means

so a and b are optional, but b can be used only when a is used. But for
make_interval I can use "months" arguments without specification of "years"
argument.

I don't know the correct BNF for arguments with default values, but using
this doesn't look correct.

Regards

Pavel

Show quoted text

I spent a little bit of time scanning for other discrepancies between
func.sgml and pg_proc.proargnames, and found several, mostly though
not exclusively in the JSON functions. In these other cases, though,
I think there might be a good argument for making pg_proc fit the docs
not the other way around. In the JSON functions, for example, pg_proc
randomly has some functions calling the main JSON[B] input "target"
while others call it "from_json" or "json_in". I'm not real sure
which of those names is preferable, but inconsistency is not preferable.

regards, tom lane

#5Pavel Stehule
pavel.stehule@gmail.com
In reply to: Pavel Stehule (#4)
Re: Wrong parameter names for make_interval (Postgres 13)

po 5. 10. 2020 v 18:48 odesílatel Pavel Stehule <pavel.stehule@gmail.com>
napsal:

po 5. 10. 2020 v 17:53 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:

Pavel Stehule <pavel.stehule@gmail.com> writes:

po 5. 10. 2020 v 15:56 odesílatel Thomas Kellerer <shammat@gmx.net>

napsal:

So instead of
make_interval ( [ year int [, month int [, week int [, day int [, hour
int [, min int [, sec double precision ]]]]]]] )
it should be
make_interval ( [ years int [, months int [, weeks int [, days int
[,hours int [, mins int [, secs double precision ]]]]]]] )

Right, fixed.

this syntax is not correct too
It should be
make_interval( years int default 0, month int default 0, days int
default 0, hours int default 0, secs double precision default 0)

IIRC, I intentionally changed that in v13; the existence of the defaults
is sufficiently covered by the text "... fields, each of which can default
to zero". I think that was partly motivated by trying to get the function
signature to fit into limited space. The final docs-table design we ended
up with might allow undoing it, but I don't see any real reason to. The
other way is more verbose and not any clearer.

I don't understand,

the syntax [ a [, b]] means

so a and b are optional, but b can be used only when a is used. But for
make_interval I can use "months" arguments without specification of "years"
argument.

I don't know the correct BNF for arguments with default values, but using
this doesn't look correct.

I forgot the behavior of positional arguments. So this syntax is correct.
I am sorry for the noise.

Regards

Pavel

Show quoted text

Regards

Pavel

I spent a little bit of time scanning for other discrepancies between
func.sgml and pg_proc.proargnames, and found several, mostly though
not exclusively in the JSON functions. In these other cases, though,
I think there might be a good argument for making pg_proc fit the docs
not the other way around. In the JSON functions, for example, pg_proc
randomly has some functions calling the main JSON[B] input "target"
while others call it "from_json" or "json_in". I'm not real sure
which of those names is preferable, but inconsistency is not preferable.

regards, tom lane