Skip to content

Commit

Permalink
Handles snapshot of Oracle temporary tables + ignore queue tables (#5087
Browse files Browse the repository at this point in the history
)

* Creates Oracle temporary global tables as expected

* Do not try to create queue tables as they are not normal Oracle tables.

* Creates Oracle temporary global tables as expected
  • Loading branch information
filipelautert committed Oct 31, 2023
1 parent 23b4b9a commit 3398416
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
import liquibase.change.ConstraintsConfig;
import liquibase.change.core.CreateTableChange;
import liquibase.database.Database;
import liquibase.database.core.InformixDatabase;
import liquibase.database.core.MSSQLDatabase;
import liquibase.database.core.MySQLDatabase;
import liquibase.database.core.PostgresDatabase;
import liquibase.database.core.*;
import liquibase.datatype.DataTypeFactory;
import liquibase.datatype.DatabaseDataType;
import liquibase.datatype.LiquibaseDataType;
Expand Down Expand Up @@ -137,6 +134,10 @@ public Change[] fixMissing(DatabaseObject missingObject, DiffOutputControl contr
change.setTablespace(missingTable.getTablespace());
}

if (referenceDatabase instanceof OracleDatabase && missingTable.getAttribute("temporary", "no").equals("GLOBAL")) {
change.setTableType("TEMPORARY GLOBAL");
}

for (Column column : missingTable.getColumns()) {
ColumnConfig columnConfig = new ColumnConfig();
columnConfig.setName(column.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,8 @@ private List<CachedRow> queryOracle(CatalogAndSchema catalogAndSchema, String ta
"c.COMMENTS as REMARKS, A.tablespace_name as tablespace_name, CASE WHEN A.tablespace_name = " +
"(SELECT DEFAULT_TABLESPACE FROM USER_USERS) THEN 'true' ELSE null END as default_tablespace " +
"from ALL_TABLES a " +
"join ALL_TAB_COMMENTS c on a.TABLE_NAME=c.table_name and a.owner=c.owner ";
"join ALL_TAB_COMMENTS c on a.TABLE_NAME=c.table_name and a.owner=c.owner " +
"left outer join ALL_QUEUE_TABLES q ON a.TABLE_NAME = q.QUEUE_TABLE and a.OWNER = q.OWNER ";
String allCatalogsString = getAllCatalogsStringScratchData();
if (tableName != null || allCatalogsString == null) {
sql += "WHERE a.OWNER='" + ownerName + "'";
Expand Down

0 comments on commit 3398416

Please sign in to comment.