GetTableInsensitive overrides sqle.Database.GetTableInsensitive to check the pg_catalog virtual schema before falling back to user tables.
(ctx *sql.Context, tblName string)
| 165 | // GetTableInsensitive overrides sqle.Database.GetTableInsensitive to check the pg_catalog |
| 166 | // virtual schema before falling back to user tables. |
| 167 | func (d *PgReadOnlyDatabase) GetTableInsensitive(ctx *sql.Context, tblName string) (sql.Table, bool, error) { |
| 168 | if resolve.UseSearchPath && d.ReadOnlyDatabase.Schema() == "" && strings.HasPrefix(strings.ToLower(tblName), "pg_") { |
| 169 | sdb, found, err := d.GetSchema(ctx, "pg_catalog") |
| 170 | if err != nil { |
| 171 | return nil, false, err |
| 172 | } |
| 173 | if found { |
| 174 | tbl, foundTbl, err := sdb.GetTableInsensitive(ctx, tblName) |
| 175 | if err != nil { |
| 176 | return nil, false, err |
| 177 | } |
| 178 | if foundTbl { |
| 179 | return tbl, true, nil |
| 180 | } |
| 181 | } |
| 182 | } |
| 183 | return d.ReadOnlyDatabase.GetTableInsensitive(ctx, tblName) |
| 184 | } |
| 185 | |
| 186 | // ValidateNewIndexName implements the sql.SchemaObjectNameValidator interface |
| 187 | func (d *PgDatabase) ValidateNewIndexName(ctx *sql.Context, newIndexName string, skipIfExists bool) (nameAlreadyUsed bool, err error) { |
nothing calls this directly
no test coverage detected