ValidateNewIndexName implements the sql.SchemaObjectNameValidator interface
(ctx *sql.Context, newIndexName string, skipIfExists bool)
| 185 | |
| 186 | // ValidateNewIndexName implements the sql.SchemaObjectNameValidator interface |
| 187 | func (d *PgDatabase) ValidateNewIndexName(ctx *sql.Context, newIndexName string, skipIfExists bool) (nameAlreadyUsed bool, err error) { |
| 188 | nameAlreadyUsed, _, err = d.doesRelationExist(ctx, newIndexName) |
| 189 | if err != nil { |
| 190 | return false, err |
| 191 | } |
| 192 | |
| 193 | if !nameAlreadyUsed { |
| 194 | return false, nil |
| 195 | } |
| 196 | |
| 197 | if skipIfExists { |
| 198 | return true, nil |
| 199 | } |
| 200 | |
| 201 | return nameAlreadyUsed, fmt.Errorf(`relation "%s" already exists`, newIndexName) |
| 202 | } |
| 203 | |
| 204 | // ValidateNewSequenceName implements the sql.SchemaObjectNameValidator interface |
| 205 | func (d *PgDatabase) ValidateNewSequenceName(ctx *sql.Context, newSequenceName string, skipIfExists bool) (nameAlreadyUsed bool, err error) { |
nothing calls this directly
no test coverage detected