Skip to content

chore: pgbouncer config - #2397

Open
staaldraad wants to merge 1 commit into
developfrom
etienne/prodsec-250
Open

chore: pgbouncer config#2397
staaldraad wants to merge 1 commit into
developfrom
etienne/prodsec-250

Conversation

@staaldraad

Copy link
Copy Markdown
Member

Ensure login always happens against the primary database.

@staaldraad
staaldraad requested review from a team as code owners August 25, 2026 11:54
@mmlb

mmlb commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Hey @staaldraad this commit/PR is pretty hard to understand. Can you go into a little more detail in the commit message please, what happens now (random db is chosen?)

Ensure pgbouncer uses the default database when calling the auth_query
function, preventing failure when trying to lookup the function during a
non-default database login.
@staaldraad
staaldraad force-pushed the etienne/prodsec-250 branch from 206fbb1 to 8a279b7 Compare August 25, 2026 14:36
@AndrewJackson2020

Copy link
Copy Markdown

Looking at the pgbouncer source code [0] it looks like if auth_dbname is not specified then whichever database the client is connecting to is used as the auth database. Pgbouncer will execute the auth query SELECT * FROM pgbouncer.get_auth($1) on that auth database. If the get_auth function was not deployed to this database then it will cause the auth to fail.

Have not tested this myself, just the read of the code. Also will say this default behavior is not described in the pgbouncer docs [1].

[0]https://github.com/pgbouncer/pgbouncer/blob/c0d4162c15706e711e8e49a031dad84ed1b1dda2/src/client.c#L43
[1] https://github.com/pgbouncer/pgbouncer/blob/c0d4162c15706e711e8e49a031dad84ed1b1dda2/doc/config.md?plain=1#L546

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

Successfully merging this pull request may close these issues.

3 participants