MCPcopy Index your code
hub / github.com/zalando/postgres-operator / execCreateOrAlterDatabase

Method execCreateOrAlterDatabase

pkg/cluster/database.go:380–389  ·  view source on GitHub ↗
(databaseName, owner, statement, doing, operation string)

Source from the content-addressed store, hash-verified

378}
379
380func (c *Cluster) execCreateOrAlterDatabase(databaseName, owner, statement, doing, operation string) error {
381 if !c.databaseNameOwnerValid(databaseName, owner) {
382 return nil
383 }
384 c.logger.Infof("%s %q owner %q", doing, databaseName, owner)
385 if _, err := c.pgDb.Exec(fmt.Sprintf(statement, databaseName, owner)); err != nil {
386 return fmt.Errorf("could not execute %s: %v", operation, err)
387 }
388 return nil
389}
390
391func (c *Cluster) databaseNameOwnerValid(databaseName, owner string) bool {
392 if _, ok := c.pgUsers[owner]; !ok {

Callers 2

executeCreateDatabaseMethod · 0.95

Calls 1

Tested by

no test coverage detected