{"record":{"id":"5ee6d16f96b91c1b","repo":"t8y2/dbx","slug":"table-not-found-s-s","errorCode":null,"errorMessage":"table not found: %s.%s","messagePattern":"table not found: (.+?)\\.(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/oracle-go/main.go","lineNumber":3435,"sourceCode":"\tif fallbackErr != nil && !errors.Is(fallbackErr, sql.ErrNoRows) {\n\t\tif metadataErr != nil {\n\t\t\treturn \"\", fmt.Errorf(\n\t\t\t\t\"failed to load view source for %s.%s: DBMS_METADATA: %v; ALL_VIEWS: %w\",\n\t\t\t\tschema, viewName, metadataErr, fallbackErr,\n\t\t\t)\n\t\t}\n\t\treturn \"\", fmt.Errorf(\"failed to load view source for %s.%s from ALL_VIEWS: %w\", schema, viewName, fallbackErr)\n\t}\n\treturn \"\", fmt.Errorf(\"view source not found: %s.%s\", schema, viewName)\n}\n\nfunc (s *server) buildTableDDL(schema, table string) (string, error) {\n\tcolumns, err := s.getColumns(schema, table)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tif len(columns) == 0 {\n\t\treturn \"\", fmt.Errorf(\"table not found: %s.%s\", schema, table)\n\t}\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"CREATE TABLE \")\n\tbuilder.WriteString(quoteIdentifier(schema))\n\tbuilder.WriteByte('.')\n\tbuilder.WriteString(quoteIdentifier(table))\n\tbuilder.WriteString(\" (\\n\")\n\tfor i, column := range columns {\n\t\tif i > 0 {\n\t\t\tbuilder.WriteString(\",\\n\")\n\t\t}\n\t\tbuilder.WriteString(\"  \")\n\t\tbuilder.WriteString(quoteIdentifier(column.Name))\n\t\tbuilder.WriteByte(' ')\n\t\tbuilder.WriteString(oracleColumnTypeDDL(column))\n\t\tif column.ColumnDefault != nil && strings.TrimSpace(*column.ColumnDefault) != \"\" {\n\t\t\tbuilder.WriteString(\" DEFAULT \")\n\t\t\tbuilder.WriteString(strings.TrimSpace(*column.ColumnDefault))","sourceCodeStart":3417,"sourceCodeEnd":3453,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/oracle-go/main.go#L3417-L3453","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"// before\nddl, err := s.buildTableDDL(\"myschema\", \"MyTable\") // case mismatch -> 0 columns\n// after\nddl, err := s.buildTableDDL(\"MYSCHEMA\", \"MYTABLE\") // matches ALL_TAB_COLUMNS","handlingStrategy":"validation","validationCode":"exists, err := db.Query(\"SELECT COUNT(*) FROM all_tables WHERE owner = UPPER(?) AND table_name = UPPER(?)\", schema, table)\n// check count > 0 before calling buildTableDDL","typeGuard":null,"tryCatchPattern":"if err != nil {\n\tif strings.Contains(err.Error(), \"table not found\") {\n\t\t// fall back or surface a friendly \"table does not exist or is not visible\" message\n\t}\n\treturn err\n}","preventionTips":["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."],"tags":["oracle","metadata","table-not-found"],"backgroundTag":"table-not-found","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}