A typo?

Started by PG Bug reporting formabout 2 years ago5 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/plpgsql-declarations.html
Description:

Under 43.3.1, "Notice that we omitted RETURNS real — we could have included
it, but it would be redundant."
Should that be "RETURNS tax" instead of "RETURNS real"?

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: PG Bug reporting form (#1)
Re: A typo?

On Saturday, April 6, 2024, PG Doc comments form <noreply@postgresql.org>
wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/plpgsql-declarations.html
Description:

Under 43.3.1, "Notice that we omitted RETURNS real — we could have included
it, but it would be redundant."
Should that be "RETURNS tax" instead of "RETURNS real"?

The docs are correct.

David J.

#3jian he
jian.universality@gmail.com
In reply to: PG Bug reporting form (#1)
Re: A typo?

On Sun, Apr 7, 2024 at 6:30 PM PG Doc comments form
<noreply@postgresql.org> wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/plpgsql-declarations.html
Description:

Under 43.3.1, "Notice that we omitted RETURNS real — we could have included
it, but it would be redundant."
Should that be "RETURNS tax" instead of "RETURNS real"?

I think it's related to the plpgsql "RETURNS" and "RETURN" confusion.
RETURN can appear between "begin", "end".
RETURNS need to specify before "AS".

not omit "RETURNS real" would be:

CREATE FUNCTION sales_tax(subtotal real, OUT tax real) returns real AS $$
BEGIN
tax := subtotal * 0.06;
END;
$$ LANGUAGE plpgsql;

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: David G. Johnston (#2)
Re: A typo?

"David G. Johnston" <david.g.johnston@gmail.com> writes:

On Saturday, April 6, 2024, PG Doc comments form <noreply@postgresql.org>
wrote:

Under 43.3.1, "Notice that we omitted RETURNS real — we could have included
it, but it would be redundant."
Should that be "RETURNS tax" instead of "RETURNS real"?

The docs are correct.

Specifically, that bit is a declaration of the data type of the
function's result, not a specification of how to compute it.

regards, tom lane

#5David G. Johnston
david.g.johnston@gmail.com
In reply to: jian he (#3)
Re: A typo?

On Sun, Apr 7, 2024 at 7:24 AM jian he <jian.universality@gmail.com> wrote:

On Sun, Apr 7, 2024 at 6:30 PM PG Doc comments form
<noreply@postgresql.org> wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/16/plpgsql-declarations.html
Description:

Under 43.3.1, "Notice that we omitted RETURNS real — we could have

included

it, but it would be redundant."
Should that be "RETURNS tax" instead of "RETURNS real"?

I think it's related to the plpgsql "RETURNS" and "RETURN" confusion.
RETURN can appear between "begin", "end".
RETURNS need to specify before "AS".

Right, the OP needs to have consulted the CREATE FUNCTION reference page to
find the definition of the RETURNS clause since it is language agnostic.

https://www.postgresql.org/docs/current/sql-createfunction.html

David J.