t8y2/dbx · error
table not found: %s.%s
Error message
table not found: %s.%s
What it means
buildTableDDL generates a CREATE TABLE statement after fetching the table's column metadata via getColumns. If getColumns returns no columns, the driver concludes the schema.table does not exist (or is not visible to the connected user) and refuses to emit DDL for a zero-column table. It is a lookup/permissions failure, not a corruption of the table.
Source
Thrown at agents/drivers/oracle-go/main.go:3435
if fallbackErr != nil && !errors.Is(fallbackErr, sql.ErrNoRows) {
if metadataErr != nil {
return "", fmt.Errorf(
"failed to load view source for %s.%s: DBMS_METADATA: %v; ALL_VIEWS: %w",
schema, viewName, metadataErr, fallbackErr,
)
}
return "", fmt.Errorf("failed to load view source for %s.%s from ALL_VIEWS: %w", schema, viewName, fallbackErr)
}
return "", fmt.Errorf("view source not found: %s.%s", schema, viewName)
}
func (s *server) buildTableDDL(schema, table string) (string, error) {
columns, err := s.getColumns(schema, table)
if err != nil {
return "", err
}
if len(columns) == 0 {
return "", fmt.Errorf("table not found: %s.%s", schema, table)
}
var builder strings.Builder
builder.WriteString("CREATE TABLE ")
builder.WriteString(quoteIdentifier(schema))
builder.WriteByte('.')
builder.WriteString(quoteIdentifier(table))
builder.WriteString(" (\n")
for i, column := range columns {
if i > 0 {
builder.WriteString(",\n")
}
builder.WriteString(" ")
builder.WriteString(quoteIdentifier(column.Name))
builder.WriteByte(' ')
builder.WriteString(oracleColumnTypeDDL(column))
if column.ColumnDefault != nil && strings.TrimSpace(*column.ColumnDefault) != "" {
builder.WriteString(" DEFAULT ")
builder.WriteString(strings.TrimSpace(*column.ColumnDefault))View on GitHub (pinned to c0390bff16)
Solutions
- Verify the table exists and check its exact case: SELECT owner, table_name FROM all_tables WHERE table_name = UPPER('<table>').
- Pass schema and table names in the case Oracle stores them (usually UPPERCASE unless created quoted).
- Grant the connected user visibility: GRANT SELECT ON <schema>.<table> or use a user with dictionary access.
- Confirm the connection targets the correct database/service (check DSN/TNS alias).
Example fix
// before
ddl, err := s.buildTableDDL("myschema", "MyTable") // case mismatch -> 0 columns
// after
ddl, err := s.buildTableDDL("MYSCHEMA", "MYTABLE") // matches ALL_TAB_COLUMNS Defensive patterns
Strategy: validation
Validate before calling
exists, err := db.Query("SELECT COUNT(*) FROM all_tables WHERE owner = UPPER(?) AND table_name = UPPER(?)", schema, table)
// check count > 0 before calling buildTableDDL Try / catch
if err != nil {
if strings.Contains(err.Error(), "table not found") {
// fall back or surface a friendly "table does not exist or is not visible" message
}
return err
} Prevention
- Always uppercase Oracle identifiers unless they were created with quotes.
- Pre-check all_tables/all_tab_columns before generating DDL.
- Ensure the connect user has SELECT privilege on the target schema's tables.
- Log the schema.table pair actually passed to the DDL builder.
When it happens
Trigger: Calling the DDL-building path (buildTableDDL) with a schema.table combination for which getColumns returns an empty column list — e.g. querying ALL_TAB_COLUMNS with a case-mismatched name, a nonexistent table, or a table in another schema the user cannot see.
Common situations: Quoting identifiers with the wrong case (Oracle stores uppercase by default), connecting as a user lacking SELECT ANY DICTIONARY/privileges on the target schema, typo in schema or table name, or pointing the driver at a different database/service than intended.
Related errors
- Table not found: {schema}.{table}
- object not found: %s.%s
- Object source is not supported
- Object source is not supported
- Object source is not supported
AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05).
Data as JSON: /api/errors/5ee6d16f96b91c1b.
Report an issue: GitHub.