Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: filter out Oracle invisible columns (#6795)

Danny Xu32e663dfc6b6
diff --git a/backend/plugin/db/oracle/sync.go b/backend/plugin/db/oracle/sync.go
index 482bcbcd94..bd8cebec23 100644
--- a/backend/plugin/db/oracle/sync.go
+++ b/backend/plugin/db/oracle/sync.go
@@ -181,6 +181,8 @@ func getTables(txn *sql.Tx) (map[string][]*storepb.TableMetadata, error) {
func getTableColumns(txn *sql.Tx) (map[db.TableKey][]*storepb.ColumnMetadata, error) {
columnsMap := make(map[db.TableKey][]*storepb.ColumnMetadata)
+ // https://github.com/bytebase/bytebase/issues/6663
+ // Invisible columns don't have column ID so that we need to filter out them.
query := fmt.Sprintf(`
SELECT
OWNER,
@@ -191,7 +193,7 @@ func getTableColumns(txn *sql.Tx) (map[db.TableKey][]*storepb.ColumnMetadata, er
DATA_DEFAULT,
NULLABLE
FROM sys.all_tab_columns
- WHERE OWNER NOT IN (%s) AND OWNER NOT LIKE 'APEX_%%'
+ WHERE OWNER NOT IN (%s) AND OWNER NOT LIKE 'APEX_%%' AND COLUMN_ID IS NOT NULL
ORDER BY OWNER, TABLE_NAME, COLUMN_ID`, systemSchema)
rows, err := txn.Query(query)
if err != nil {