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

CDS database engine does not account for schema parameter #7197

Open
gsalingu opened this issue Oct 30, 2024 · 0 comments
Open

CDS database engine does not account for schema parameter #7197

gsalingu opened this issue Oct 30, 2024 · 0 comments

Comments

@gsalingu
Copy link
Contributor

While running on new versions of postgresql the automatic schema selection at connection time does not seem to work


user=cds-cdn password='PASSWORD' dbname=cds host=db port=5000 sslmode=disable connect_timeout=10 options='-csearch_path=cdn'
Error: pq: permission denied for schema public
github.com/ovh/cds/sdk.WithStack
	/home/gsalingu/github/ovh/cds/sdk/error.go:638
github.com/ovh/cds/engine/database/dbmigrate.lockMigrate
	/home/gsalingu/github/ovh/cds/engine/database/dbmigrate/migrate.go:68
github.com/ovh/cds/engine/database/dbmigrate.Do
	/home/gsalingu/github/ovh/cds/engine/database/dbmigrate/migrate.go:36
main.ApplyMigrations
	/home/gsalingu/github/ovh/cds/engine/cmd_database.go:315
main.databaseUpgradeCmdFunc
	/home/gsalingu/github/ovh/cds/engine/cmd_database.go:133
github.com/spf13/cobra.(*Command).execute
	/home/gsalingu/go/pkg/mod/github.com/spf13/[email protected]/command.go:987
github.com/spf13/cobra.(*Command).ExecuteC
	/home/gsalingu/go/pkg/mod/github.com/spf13/[email protected]/command.go:1115
github.com/spf13/cobra.(*Command).Execute
	/home/gsalingu/go/pkg/mod/github.com/spf13/[email protected]/command.go:1039
main.main
	/home/gsalingu/github/ovh/cds/engine/main.go:26
runtime.main
	/home/gsalingu/.go/src/runtime/proc.go:272
runtime.goexit
	/home/gsalingu/.go/src/runtime/asm_amd64.s:1700

the "cds-cdn" user has only permissions on the "cdn" schema, that showcases the fact that in spite of selecting the cdn schema in the command line the binary tried to connect to the public schema

I tried to update the code generating the connection string itself in several ways but postgresql does not seem to play nice with this.

What works well is an exec statement right after the connection
I will relay a pull request to propose a fix shortly after submission of this issue

@gsalingu gsalingu changed the title CDS database engine does not account for scema CDS database engine does not account for schema parameter Oct 30, 2024
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