Skip to content

Set PostgreSQL application name#1202

Merged
brontolosone merged 1 commit intogetodk:nextfrom
brontolosone:pgappname
Sep 5, 2025
Merged

Set PostgreSQL application name#1202
brontolosone merged 1 commit intogetodk:nextfrom
brontolosone:pgappname

Conversation

@brontolosone
Copy link
Contributor

@brontolosone brontolosone commented Aug 1, 2025

Related: getodk/central-backend#1570

What has been done to verify that this works as intended?

Ran the container constellation, connected to postgresql-14-1, witnessed odkcentral showing up in a select distinct(application_name) from pg_stat_activity where datname = 'odk' order by application_name query.

Why is this the best possible solution? Were any other approaches considered?

Well, you can set the application name in the connection string as well, but doing it through the environment inheritance is much easier, no code required. Perhaps we should do all connection parameters this way? And then we might automatically support all the things libpq supports, including client certs, local Unix sockets, etc.

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Nothing unless some user's software depends on that application name not being set of course. And if they already had a PGAPPNAME env var, we're not overriding it.

Does this change require updates to documentation? If so, please file an issue here and include the link below.

No changes required.

Before submitting this PR, please make sure you have:

  • branched off and targeted the next branch OR only changed documentation/infrastructure (master is stable and used in production)
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

@brontolosone brontolosone marked this pull request as ready for review August 1, 2025 11:33
@brontolosone brontolosone requested a review from alxndrsn August 1, 2025 11:33
Copy link
Contributor

@alxndrsn alxndrsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the others are in alphabetical order; otherwise looks great 👍

@matthew-white
Copy link
Member

I might mention this change in release notes, so I'm going to add the PR to the project. (There's no associated issue, right? I usually only add a PR to the project when there's no GitHub issue.)

@github-project-automation github-project-automation bot moved this to 🕒 backlog in ODK Central Aug 15, 2025
@matthew-white matthew-white moved this from 🕒 backlog to ✏️ in progress in ODK Central Aug 15, 2025
Copy link
Contributor

@alxndrsn alxndrsn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All the other env vars are listed in alphabetical order, so this one should probably be too.

Apart from that, this PR looks great 👍

@brontolosone brontolosone force-pushed the pgappname branch 2 times, most recently from 6bd5e6f to 15f63fa Compare September 4, 2025 10:23
@brontolosone brontolosone merged commit 70d1ef7 into getodk:next Sep 5, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from ✏️ in progress to ✅ done in ODK Central Sep 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅ done

Development

Successfully merging this pull request may close these issues.

3 participants