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

feat: preliminary adaptation of gaussdb #12061

Closed
wants to merge 14 commits into from
Prev Previous commit
Next Next commit
gauss dml ok 20240520
  • Loading branch information
shanzhuer committed May 20, 2024
commit a17d902d3226e7885cb3fdcf42c25af5b2b0f949
6 changes: 3 additions & 3 deletions backend/plugin/db/gauss/gauss.go
shanzhuer marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func (driver *Driver) Open(_ context.Context, _ storepb.Engine, config db.Connec
if config.Database != "" {
dsn = fmt.Sprintf("%s/%s", dsn, config.Database)
}
//slog.Debug("ready to open==" + dsn)
db, err := sql.Open(driverName, dsn)
if err != nil {
return nil, err
Expand Down Expand Up @@ -189,7 +188,8 @@ func (driver *Driver) Execute(ctx context.Context, statement string, opts db.Exe
}
defer tx.Rollback()
// Set the current transaction role to the database owner so that the owner of created objects will be the same as the database owner.
if _, err := tx.ExecContext(ctx, fmt.Sprintf("SET SESSION AUTHORIZATION '%s'", owner)); err != nil {
//if _, err := tx.ExecContext(ctx, fmt.Sprintf("SET SESSION AUTHORIZATION '%s';", owner)); err != nil {
if _, err := tx.ExecContext(ctx, "SET SESSION AUTHORIZATION DEFAULT;"); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

There seems no need to run this statement.

return 0, err
}

Expand Down Expand Up @@ -243,7 +243,7 @@ func (driver *Driver) Execute(ctx context.Context, statement string, opts db.Exe
}

// Restore the current transaction role to the current user.
if _, err := tx.ExecContext(ctx, "SET SESSION AUTHORIZATION DEFAULT"); err != nil {
if _, err := tx.ExecContext(ctx, "SET SESSION AUTHORIZATION DEFAULT;"); err != nil {
slog.Warn("Failed to restore the current transaction role to the current user", log.BBError(err))
}

Expand Down