You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The user of the DB is supposed to handle user/db creation them self hence the default app user/db created by bootstrap.initdb isn't needed.
Describe the solution you'd like
We like to see an option where none of the bootstrap options (initdb/pg_basebackup/recovery) is used e.g. by configuring bootstrap: false.
Describe alternatives you've considered
I've checked, but couldn't find any option to disable the app db/user creation.
Additional context
No response
Backport?
No
Code of Conduct
I agree to follow this project's Code of Conduct
Reacted by Terdunov Vyacheslav, Jakob Kartschall, Kuangda He, siarhei-kudrautsau, ermakov-oleg, Harpo, Arthur Le Roux, Eigil Skjæveland, Arren, Sebastian Hoß and 9 more
Oh ... I get it now. We cannot skip initdb as that's required by Postgres to create a cluster. You simply want, as part of the initdb bootstrap, to avoid creating an app user and database. Is this correct?
We are having the same problem with clusters bootstrapped from external non-CNPG databases. The operator keeps trying to alter the app role after booting the base and fails with ERROR: role \"app\" does not exist.
We don't use the app database and role so we would like them to be togglable.
I also get this error after using initdb.import from a non-cnpg deployment of cnpg that doesn't have an "app" anything. I'm importing one database and one role, which works flawlessly. The database, owner, and password all appear correct and work. However, the -app secret gets created nevertheless with the username as "app" and the Reconciler Error regularly appearing stating that <"error":"while updating database owner password: ERROR: role "app" does not exist (SQLSTATE 42704)"> .
Is there a known documented solution to this that I'm missing, or some magic workaround other than manually creating the "app" role to make cnpg happy once again?
Dear @github-actions, this issues might not have been touch in 60 days but is still a requested feature from 3 user which certainly still like to see it implemented.
Dear @github-actions, this issues might not have been touch in 60 days but is still a requested feature from 3 user which certainly still like to see it implemented.
You're correct—@mnencia's proposal to deprecate the default creation of the 'app' user/database is only partially implemented. The operator still defaults to creating the 'app' user, database, and the {cluster-name}-app secret unless you explicitly unset or remove the bootstrap database and owner fields in your cluster spec. This legacy behavior persists even after restore/import operations, except in some specialized cases like monolith imports, where improvements are underway but not fully resolved yet. There isn't a simple flag or configuration to globally suppress all legacy 'app' resource creation at this time, and the issue is recognized by maintainers for further discussion and resolution in future releases. For now, explicit configuration is required to avoid these defaults. Relevant code logic | Issue tracking monolith import bug
You're right—this feature request is still open and only partially addressed. By default, CloudNativePG continues to create the 'app' user, database, and secret unless you explicitly set the bootstrap initdb database and owner to something else (like 'postgres') and manage users via secrets and post-init SQL. There is no global flag or option to fully suppress legacy 'app' resource creation yet, and the proposal to deprecate these defaults is still under discussion and not fully implemented. Declarative role and database management is recommended for explicit control, but it doesn't currently prevent the default 'app' resources from being created by default. For now, explicit configuration is required to avoid these defaults source.
I don't have the ability to remove labels or perform repository actions. The "stale" label is managed by the GitHub Actions bot or repository maintainers. If you want the label removed, someone with write access to the repository will need to do it. The issue itself is still relevant and has been recognized by maintainers.
4. **Documentation**: Update all relevant documentation and examples to encourage the use of [Declarative Database Management](https://cloudnative-pg.io/documentation/1.26/declarative_database_management/) for databases and [Declarative Role Management](https://cloudnative-pg.io/documentation/1.26/declarative_role_management/) for roles, making database and user management explicit and fully declarative.
Additional Considerations
If you currently use postInitApplicationSQL or postInitApplicationSQLRef in your initialization strategy, please note that Declarative Database Management does not yet provide an equivalent mechanism for creating an application database as part of the bootstrap.
Is there a issue/discussion/roadmap to watch these declarative database/schema management at? be interested in seeing what others thoughts are on:
use of public schema (would love to have the option to NOT create it by default)
Is there a known documented solution to this that I'm missing, or some magic workaround other than manually creating the "app" role to make cnpg happy once again?
The microservice approach adheres to CloudNativePG conventions and defaults for the destination cluster. If you do not set initdb.database or initdb.owner for the destination cluster, both parameters will default to app.
Activity
gbartolini commentedon Oct 31, 2023
What does that even mean?
gbartolini commentedon Oct 31, 2023
Oh ... I get it now. We cannot skip
initdbas that's required by Postgres to create a cluster. You simply want, as part of the initdb bootstrap, to avoid creating an app user and database. Is this correct?baurmatt commentedon Oct 31, 2023
That's correct, yes. Sorry for being inaccurate about this!
cterence commentedon Feb 13, 2024
We are having the same problem with clusters bootstrapped from external non-CNPG databases. The operator keeps trying to alter the app role after booting the base and fails with
ERROR: role \"app\" does not exist.We don't use the app database and role so we would like them to be togglable.
T1mK commentedon Nov 22, 2024
I also get this error after using initdb.import from a non-cnpg deployment of cnpg that doesn't have an "app" anything. I'm importing one database and one role, which works flawlessly. The database, owner, and password all appear correct and work. However, the -app secret gets created nevertheless with the username as "app" and the Reconciler Error regularly appearing stating that <"error":"while updating database owner password: ERROR: role "app" does not exist (SQLSTATE 42704)"> .
Is there a known documented solution to this that I'm missing, or some magic workaround other than manually creating the "app" role to make cnpg happy once again?
Thanks a lot for you help!
github-actions commentedon Feb 15, 2025
This issue is stale because it has been open for 60 days with no activity.
baurmatt commentedon Feb 17, 2025
Dear @github-actions, this issues might not have been touch in 60 days but is still a requested feature from 3 user which certainly still like to see it implemented.
github-actions commentedon May 8, 2025
This issue is stale because it has been open for 60 days with no activity.
baurmatt commentedon May 12, 2025
Dear @github-actions, this issues might not have been touch in 60 days but is still a requested feature from 3 user which certainly still like to see it implemented.
14 remaining items
pschichtel commentedon Sep 15, 2025
@dosubot I think @mnencia's change only partially implemented this.
dosubot commentedon Sep 15, 2025
You're correct—@mnencia's proposal to deprecate the default creation of the 'app' user/database is only partially implemented. The operator still defaults to creating the 'app' user, database, and the
{cluster-name}-appsecret unless you explicitly unset or remove the bootstrapdatabaseandownerfields in your cluster spec. This legacy behavior persists even after restore/import operations, except in some specialized cases like monolith imports, where improvements are underway but not fully resolved yet. There isn't a simple flag or configuration to globally suppress all legacy 'app' resource creation at this time, and the issue is recognized by maintainers for further discussion and resolution in future releases. For now, explicit configuration is required to avoid these defaults.Relevant code logic | Issue tracking monolith import bug
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
baurmatt commentedon Sep 16, 2025
@dosubot This feature request is still relevant.
dosubot commentedon Sep 16, 2025
You're right—this feature request is still open and only partially addressed. By default, CloudNativePG continues to create the 'app' user, database, and secret unless you explicitly set the bootstrap
initdbdatabase and owner to something else (like 'postgres') and manage users via secrets and post-init SQL. There is no global flag or option to fully suppress legacy 'app' resource creation yet, and the proposal to deprecate these defaults is still under discussion and not fully implemented. Declarative role and database management is recommended for explicit control, but it doesn't currently prevent the default 'app' resources from being created by default. For now, explicit configuration is required to avoid these defaults source.To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
baurmatt commentedon Sep 16, 2025
@dosubot Then please remove the
Stalelabel...dosubot commentedon Sep 16, 2025
Sorry, I am not sure how to help. Please re-word your message and try again.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
baurmatt commentedon Sep 16, 2025
@dosu Please remove the
Stalelabel on this issue. It has been added by you 18 hours ago.BjoernPetersen commentedon Nov 12, 2025
@dosubot this issue is not stale
dosubot commentedon Nov 12, 2025
I don't have the ability to remove labels or perform repository actions. The "stale" label is managed by the GitHub Actions bot or repository maintainers. If you want the label removed, someone with write access to the repository will need to do it. The issue itself is still relevant and has been recognized by maintainers.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
acelinkio commentedon Apr 16, 2026
Is there a issue/discussion/roadmap to watch these declarative database/schema management at? be interested in seeing what others thoughts are on:
gbartolini commentedon Jun 19, 2026
See https://cloudnative-pg.io/docs/current/database_import#the-microservice-type
Specifically: