Mismatch for connection key/value pair between documentation and code?
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/16/libpq-connect.html
Description:
Hi PostgreSQL documentation team,
I have a confusion regarding parameters used in documentation vs. that in
the code. Please clarify if I misunderstand something there or.
Thanks,
Joe
For the following document regarding connect string, it is not aligned with
the code.
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
e.g. Timeout for connection
In the above document,it states the following:
"connect_timeout
Maximum time to wait while connecting, in seconds (write as a decimal
integer, e.g., 10). Zero, negative, or not specified means wait
indefinitely. The minimum allowed timeout is 2 seconds, therefore a value of
1 is interpreted as 2. This timeout applies separately to each host name or
IP address. For example, if you specify two hosts and connect_timeout is 5,
each host will time out if no connection is made within 5 seconds, so the
total time spent waiting for a connection might be up to 10 seconds."
However in the code:
https://github.com/npgsql/npgsql/blob/docs/src/Npgsql/NpgsqlConnectionStringBuilder.cs,
starting L789 to L812 (latest version when I raise this ticket).
The name is Timeout instead of connect_timeout, and there's no logic
regarding 2 second check
/// <summary>
/// The time to wait (in seconds) while trying to establish a connection
before terminating the attempt and generating an error.
/// Defaults to 15 seconds.
/// </summary>
[Category("Timeouts")]
[Description("The time to wait (in seconds) while trying to establish a
connection before terminating the attempt and generating an error.")]
[DisplayName("Timeout")]
[NpgsqlConnectionStringProperty]
[DefaultValue(DefaultTimeout)]
public int Timeout
{
get => _timeout;
set
{
if (value < 0 || value > NpgsqlConnection.TimeoutLimit)
throw new ArgumentOutOfRangeException(nameof(value), value,
"Timeout must be between 0 and " + NpgsqlConnection.TimeoutLimit);
_timeout = value;
SetValue(nameof(Timeout), value);
}
}
int _timeout;
internal const int DefaultTimeout = 15;
On Monday, July 15, 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/libpq-connect.html
Description:For the following document regarding connect string, it is not aligned with
the code.
https://www.postgresql.org/docs/current/libpq-connect.
html#LIBPQ-CONNSTRINGe.g. Timeout for connection
"connect_timeout
Maximum time to wait while connecting, in seconds (write as a decimal
integer, e.g., 10).
However in the code:
https://github.com/npgsql/npgsql/blob/docs/src/Npgsql/
NpgsqlConnectionStringBuilder.cs,
starting L789 to L812 (latest version when I raise this ticket).
The name is Timeout instead of connect_timeout, and there's no logic
regarding 2 second check
Probably this third-party module is not using the libpq API. Or at minimum
not that aspect of the API.
David J.
Hi David,
Thanks for your clarification.
Best regards,
Joe
joe.zhou@dualhelios.com
From: David G. Johnston
Date: 2024-07-16 22:20
To: joe.zhou@dualhelios.com; pgsql-docs@lists.postgresql.org
Subject: Re: Mismatch for connection key/value pair between documentation and code?
On Monday, July 15, 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/libpq-connect.html
Description:
For the following document regarding connect string, it is not aligned with
the code.
https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
e.g. Timeout for connection
"connect_timeout
Maximum time to wait while connecting, in seconds (write as a decimal
integer, e.g., 10).
However in the code:
https://github.com/npgsql/npgsql/blob/docs/src/Npgsql/NpgsqlConnectionStringBuilder.cs,
starting L789 to L812 (latest version when I raise this ticket).
The name is Timeout instead of connect_timeout, and there's no logic
regarding 2 second check
Probably this third-party module is not using the libpq API. Or at minimum not that aspect of the API.
David J.