Add option to customize admin schema for PostgreSQL auto user provisioning#43338
Closed
gabrielcorado wants to merge 1 commit intomasterfrom
Closed
Add option to customize admin schema for PostgreSQL auto user provisioning#43338gabrielcorado wants to merge 1 commit intomasterfrom
gabrielcorado wants to merge 1 commit intomasterfrom
Conversation
greedy52
reviewed
Jun 21, 2024
| return nil | ||
| } | ||
|
|
||
| if db.GetProtocol() != defaults.ProtocolPostgres || (db.GetType() != types.DatabaseTypeSelfHosted && !db.IsRDS() && !db.IsRedshift()) { |
Contributor
There was a problem hiding this comment.
Suggested change
| if db.GetProtocol() != defaults.ProtocolPostgres || (db.GetType() != types.DatabaseTypeSelfHosted && !db.IsRDS() && !db.IsRedshift()) { | |
| if db.GetProtocol() != defaults.ProtocolPostgres { |
| } | ||
| conn, err := e.pgxConnect(ctx, sessionCtx.WithUserAndDatabase(sessionCtx.Database.GetAdminUser().Name, loginDatabase)) | ||
|
|
||
| conn, err := e.pgxConnect(ctx, sessionCtx.WithUserAndDatabase(sessionCtx.Database.GetAdminUser().Name, loginDatabase), loginSchema) |
Contributor
There was a problem hiding this comment.
Suggested change
| conn, err := e.pgxConnect(ctx, sessionCtx.WithUserAndDatabase(sessionCtx.Database.GetAdminUser().Name, loginDatabase), loginSchema) | |
| conn, err := e.pgxConnect(ctx, sessionCtx.WithUserAndDatabase(sessionCtx.Database.GetAdminUser().Name, loginDatabase).WithStartupParams(runtimeParams)) |
What do you think if we update the sessionCtx with runtime params needed for admin instead of changing pgxConnect
| } | ||
|
|
||
| if sessionCtx.Database.GetAdminUser().DefaultSchema != "" { | ||
| loginSchema = sessionCtx.Database.GetAdminUser().DefaultSchema |
Contributor
There was a problem hiding this comment.
Could we log this schema the above log
Contributor
|
Could you share the documentation change as well? Thanks! |
Contributor
|
superseded by #44255 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #37609.
This PR adds a new option,
default_schema, to customize the PostgreSQL schema where the procedures will be stored. When establishing a connection, we provide thesearch_pathoption. This option ensures the procedures are created on the schema and correctly found when called. This option works for both PostgreSQL and RedShift instances.In addition, this option requires validation to prevent users from setting it to
pg_temp(a per-session schema). This is necessary because procedures are only created once during the Teleport database session, so they are expected to be on the database when the session ends. Also,pg_tempdoesn't support creating procedures on RedShift, returning an error like "ERROR: no schema has been selected to create in".Changelog: Add an option (
admin_user.default_schema) to customize the default PostgreSQL schema admin users use when managing auto-provisioned users.