MCPcopy Create free account
hub / github.com/apecloud/myduckserver / withSchema

Method withSchema

catalog/table.go:79–97  ·  view source on GitHub ↗
(ctx *sql.Context)

Source from the content-addressed store, hash-verified

77 t.comment = comment
78 return t
79}
80
81func (t *Table) withSchema(ctx *sql.Context) error {
82 schema, err := getPKSchema(ctx, t.db.catalog, t.db.name, t.name)
83 if err != nil {
84 return err
85 }
86
87 t.schema = schema
88
89 // https://github.com/apecloud/myduckserver/issues/272
90 if len(t.schema.PkOrdinals) == 0 && configuration.IsReplicationWithoutIndex() {
91 // Pretend that the primary key exists
92 for _, idx := range t.comment.Meta.PkOrdinals {
93 t.schema.Schema[idx].PrimaryKey = true
94 }
95 t.schema = sql.NewPrimaryKeySchema(t.schema.Schema, t.comment.Meta.PkOrdinals...)
96 }
97
98 return nil
99}
100

Callers 5

AddColumnMethod · 0.95
DropColumnMethod · 0.95
ModifyColumnMethod · 0.95
setAutoIncrementValueMethod · 0.95
tablesInsensitiveMethod · 0.80

Calls 2

getPKSchemaFunction · 0.85

Tested by

no test coverage detected