(ctx *sql.Context)
| 77 | t.comment = comment |
| 78 | return t |
| 79 | } |
| 80 | |
| 81 | func (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 |
no test coverage detected