t8y2/dbx · error

table not found: %s.%s

Error message

table not found: %s.%s

What it means

buildFallbackTableDDL reconstructs a table's DDL from a SELECT over it (columnsFromSelect). If the query yields zero columns, the driver concludes the table does not exist (or is unreadable) and throws this error instead of rendering an empty DDL.

Source

Thrown at agents/drivers/xugu/main.go:3745

		}
	}
	// DBMS_METADATA.GET_DDL can block indefinitely on XuguDB, even when the
	// table metadata itself is accessible. Reconstruct the DDL from the same
	// ALL_* catalog views used by the object browser instead.
	ddl, err := s.buildTableDDL(catalogSchema, catalogTable)
	if err != nil {
		return "", err
	}
	return s.appendTableIndexDDL(catalogSchema, catalogTable, ddl), nil
}

func (s *server) buildFallbackTableDDL(schema, table string) (string, error) {
	columns, err := s.columnsFromSelect(schema, table, map[string]bool{})
	if err != nil {
		return "", err
	}
	if len(columns) == 0 {
		return "", fmt.Errorf("table not found: %s.%s", schema, table)
	}
	return renderXuguTableDDL(schema, table, columns, xuguTableMetadata{}, nil, nil, nil, nil), nil
}

func xuguUnavailableTableDDL(schema, table string) string {
	return fmt.Sprintf("-- XuguDB did not expose enough metadata to reconstruct %s.%s.\n-- The table may still be readable, but its DDL requires additional metadata privileges.", schema, table)
}

type xuguCatalogTableName struct {
	Schema string
	Table  string
}

// resolveCatalogTableName returns SCHEMA_NAME/TABLE_NAME exactly as stored in
// ALL_SCHEMAS/ALL_TABLES. The lookup accepts a case-insensitive input only
// when it has a single catalog candidate; otherwise it requires the exact
// stored spelling rather than silently exporting a different quoted object.
func (s *server) resolveCatalogTableName(schema, table string) (string, string, error) {

View on GitHub (pinned to c0390bff16)

Solutions

  1. Confirm the table exists: SELECT COUNT(*) FROM ALL_TABLES WHERE UPPER(TABLE_NAME)=UPPER('?') AND UPPER(SCHEMA_NAME)=UPPER('?');
  2. Check SELECT privileges on the table for the connecting user.
  3. Verify the schema/table spelling and case.
  4. If the table exists but metadata is restricted, prefer the non-fallback buildTableDDL path or grant metadata privileges.

Example fix

-- before (fallback path, no SELECT privilege)
SELECT * FROM app.orders; -- 0 columns returned -> error

-- after
GRANT SELECT ON app.orders TO app_reader;
Defensive patterns

Strategy: validation

Validate before calling

var n int
err := db.QueryRow(`SELECT COUNT(*) FROM ALL_TABLES t JOIN ALL_SCHEMAS s ON s.SCHEMA_ID=t.SCHEMA_ID WHERE UPPER(s.SCHEMA_NAME)=UPPER(?) AND UPPER(t.TABLE_NAME)=UPPER(?)`, schema, table).Scan(&n)
if err != nil || n == 0 { return fmt.Errorf("table %s.%s not visible; check existence and SELECT privilege", schema, table) }

Try / catch

if strings.HasPrefix(err.Error(), "table not found:") {
    ddl = "-- table unavailable; skipped"
}

Prevention

When it happens

Trigger: Calling the fallback DDL path for schema.table where a SELECT * FROM schema.table returns no columns — the table does not exist, the caller lacks SELECT privilege, or the schema name is wrong.

Common situations: Table dropped between listing and DDL extraction; insufficient privileges so the SELECT silently yields no metadata; typo in schema or table name; connecting to a database where the table never existed.

Related errors


AI-assisted analysis of t8y2/dbx@c0390bff16 (2026-09-05). Data as JSON: /api/errors/2556d96a4e581a29. Report an issue: GitHub.