Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connections parameters overridden by hard-coded values #453

Open
dubek opened this issue Dec 29, 2023 · 0 comments
Open

Connections parameters overridden by hard-coded values #453

dubek opened this issue Dec 29, 2023 · 0 comments

Comments

@dubek
Copy link

dubek commented Dec 29, 2023

It seems that function pglogical_connect_base overrides the values of the following connection-string parameters, if given by the user:

  • connect_timeout
  • keepalives
  • keepalives_idle
  • keepalives_interval
  • keepalives_count

This means that as of pglogical 2.4.4 there's no way to change the value of these parameters for a pglogical connection.

For example, if I set connect_timeout to an illegal non-numeric value (zzzzzz) I get no error:

SELECT pglogical.create_subscription(
  subscription_name := 'sub1',
  provider_dsn := 'host=localhost port=5432 dbname=src user=repuser password=password123 connect_timeout=zzzzzz'
);

because the illegal value is overridden by the hard-coded value of 30 that appears in pglogical.c.

If I try using such illegal value for a parameter that is not overridden (such as tcp_user_timeout), I get the expected error message:

SELECT pglogical.create_subscription(
  subscription_name := 'sub1',
  provider_dsn := 'host=localhost port=5432 dbname=src user=repuser password=password123 tcp_user_timeout=zzzzzz'
);

ERROR:  could not connect to the postgresql server: connection to server at "localhost" (127.0.0.1), port 5432 failed: invalid integer value "zzzzzz" for connection option "tcp_user_timeout"
connection to server at "localhost" (::1), port 5432 failed: invalid integer value "zzzzzz" for connection option "tcp_user_timeout"

Related:

It is not clear to me where pglogical.extra_connection_options is used: it is appended to s here:

pglogical/pglogical.c

Lines 278 to 285 in bff71f2

initStringInfo(&s);
appendStringInfoString(&s, pglogical_extra_connection_options);
appendStringInfoChar(&s, ' ');
appendStringInfoString(&s, connstr);
keys[i] = "dbname";
vals[i] = connstr;
i++;

but that s is never used. Maybe s.data should be used instead of connstr on line 284.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant