Mismatch for connection key/value pair between documentation and code?

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: joe(dot)zhou(at)dualhelios(dot)com
Subject: Mismatch for connection key/value pair between documentation and code?
Date: 2024-07-16 04:54:53
Message-ID: 172110569327.736585.18068265437149291546@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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;

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message PG Doc comments form 2024-07-16 09:11:35 Change detail text in last example of 43.5.3. Executing a Command with a Single-Row Result
Previous Message Laurenz Albe 2024-07-16 01:18:58 Re: Add small detail to RAISE statement descripton