MCPcopy Create free account
hub / github.com/dolthub/doltgresql / DropTable

Method DropTable

server/tables/pg_database.go:125–142  ·  view source on GitHub ↗

DropTable overrides sqle.Database.DropTable to prevent dropping virtual pg_catalog tables.

(ctx *sql.Context, tableName string)

Source from the content-addressed store, hash-verified

123
124// DropTable overrides sqle.Database.DropTable to prevent dropping virtual pg_catalog tables.
125func (d *PgDatabase) DropTable(ctx *sql.Context, tableName string) error {
126 if resolve.UseSearchPath && d.Database.Schema() == "" && strings.HasPrefix(strings.ToLower(tableName), "pg_") {
127 sdb, found, err := d.GetSchema(ctx, "pg_catalog")
128 if err != nil {
129 return err
130 }
131 if found {
132 _, foundTbl, err := sdb.GetTableInsensitive(ctx, tableName)
133 if err != nil {
134 return err
135 }
136 if foundTbl {
137 return sql.ErrDropTableNotSupported.New("pg_catalog")
138 }
139 }
140 }
141 return d.Database.DropTable(ctx, tableName)
142}
143
144// AllSchemas overrides sqle.ReadOnlyDatabase.AllSchemas to apply Doltgres schema wrapping.
145func (d *PgReadOnlyDatabase) AllSchemas(ctx *sql.Context) ([]sql.DatabaseSchema, error) {

Callers

nothing calls this directly

Calls 3

GetSchemaMethod · 0.95
SchemaMethod · 0.65
GetTableInsensitiveMethod · 0.45

Tested by

no test coverage detected