Autocompletion for \sf does not work if there is more than one function

2025-09-13 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/app-psql.html
Description:

test=> \sf+ app_con

test=> \sf+ app_config
ERROR:  more than one function named "app_config"

I expect to see arguments types: void or jsonb like:
test=> \sf app_con
void jsonb

Because definition for those functions are:
 Schema |Name| Result data type |
>
++--+>
 public | app_config | void | config jsonb
>
 public | app_config | jsonb| keys text[] DEF

Best regards.


ANALYZE being a read v write operation clarification

2025-09-13 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/sql-analyze.html
Description:

In the ANALYZE docs it states,
- "ANALYZE collects statistics about the contents of tables in the database,
and stores the results in the pg_statistic system catalog"
- "ANALYZE requires only a read lock on the target table".

When trying to determien if this command could be run with
`default_transaction_read_only` set to `on,` I was left stumped on whether
this is a read only or read-write operation. It is unclear to me, what
"stores" in the context of the "pg_statistic system catalog" means, and
whether that requires a write operation. I'm potentially missing
understanding on the workings of the `pg_statistic` system catalog, but
figured this could be a small improvement made to clarify the docs about
this operation.


The document contains false statements

2025-09-13 Thread PG Doc comments form
The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/sql-createfunction.html
Description:

> This is effectively another way of declaring a named OUT parameter

Actually OUT works twice slower in compare to RETURNS TABLE
https://stackoverflow.com/q/79763947/4632019

DB<>fiddle for [`OUT`](https://dbfiddle.uk/fz9L_wm0) and [`RETURNS
TABLE`](https://dbfiddle.uk/uTkU1MT8) cases.

*I hope after the fix, data centers will consume 2 times less electricity
:D.


Re: ANALYZE being a read v write operation clarification

2025-09-13 Thread David G. Johnston
On Friday, September 12, 2025, PG Doc comments form 
wrote:

> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/17/sql-analyze.html
> Description:
>
> In the ANALYZE docs it states,
> - "ANALYZE collects statistics about the contents of tables in the
> database,
> and stores the results in the pg_statistic system catalog"
> - "ANALYZE requires only a read lock on the target table".
>
> When trying to determien if this command could be run with
> `default_transaction_read_only` set to `on,` I was left stumped on whether
> this is a read only or read-write operation. It is unclear to me, what
> "stores" in the context of the "pg_statistic system catalog" means, and
> whether that requires a write operation. I'm potentially missing
> understanding on the workings of the `pg_statistic` system catalog, but
> figured this could be a small improvement made to clarify the docs about
> this operation.
>

Yes, it is a write operation - otherwise it would be pretty useless since
it has no output to the client.

It reads the contents of the named table, computes statistics, and then
saves/stores/writes them for future reference - the location being saved to
is a system catalog (a special kind of table).

If you want to propose a complete suggestion here it would be entertained,
but none of the terms seem problematic on their own. Though maybe some
requiring looking up if one is unfamiliar.  “stores the results in the
system catalog” vs. “writes the results to the system catalog” seems like a
pure style choice.  They mean the same thing.  Though I’m probably biased
as a native English speaker.  But I’d want some other opinions in favor of
changing it before I’d try to go improve it.

David J.


Re: The document contains false statements

2025-09-13 Thread Tom Lane
PG Doc comments form  writes:
> The following documentation comment has been logged on the website:
> Page: https://www.postgresql.org/docs/17/sql-createfunction.html
> Description:

>> This is effectively another way of declaring a named OUT parameter

> Actually OUT works twice slower in compare to RETURNS TABLE

You stopped reading halfway through that sentence... it says

This is effectively another way of declaring a named OUT parameter,
except that RETURNS TABLE also implies RETURNS SETOF.

The difference between a set-returning and not-set-returning
function might explain what you're seeing, particularly because
the rules for inlining SQL functions are different in the two
cases.

A documentation comment is not the place to pursue this further,
but you could ask for help on our pgsql-performance mailing list.

regards, tom lane




Re: Autocompletion for \sf does not work if there is more than one function

2025-09-13 Thread Eugen Konkov
Hello PG,

Friday, September 12, 2025, 8:55:14 PM, you wrote:

> The following documentation comment has been logged on the website:

> Page: https://www.postgresql.org/docs/17/app-psql.html
> Description:

test=>> \sf+ app_con

test=>> \sf+ app_config
> ERROR:  more than one function named "app_config"

> I expect to see arguments types: void or jsonb like:
test=>> \sf app_con
> void jsonb

> Because definition for those functions are:
>  Schema |Name| Result data type |

> ++--+>
>  public | app_config | void | config jsonb

>  public | app_config | jsonb| keys text[] DEF

> Best regards.


btw autocompletion for "DROP FUNCTION" works as expected
=> drop function app_config ( 
jsonb)   text)text[])  

I expect the similar behaviour for \sf+ 

-- 
Best regards,
Eugen Konkov