Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Oracle temporary table on generateChangeLog is created as normal table #1516

Closed
VGoudkov opened this issue Oct 28, 2020 · 6 comments · Fixed by #5087
Closed

Oracle temporary table on generateChangeLog is created as normal table #1516

VGoudkov opened this issue Oct 28, 2020 · 6 comments · Fixed by #5087

Comments

@VGoudkov
Copy link

VGoudkov commented Oct 28, 2020

Environment

Liquibase Version:
4.1.1 #10
Liquibase Integration & Version: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.>
CLI
Liquibase Extension(s) & Version:

Database Vendor & Version:
Oracle 12.2
Operating System Type & Version:
Win10

Description

Sometimes Hibernate generates following table(s)
CREATE GLOBAL TEMPORARY TABLE HT_AAA (ID NUMBER(19) NOT NULL) ON COMMIT DELETE ROWS;

GenerateChangelog creates standard changeSet, which leads to create normal (not temporary) table:






Steps To Reproduce

  1. Create a temporary table
  2. Create a changelog
  3. Apply it to other database
  4. Compare DDL's manually or by liquibase's diff
@molivasdat
Copy link
Contributor

@VGoudkov Thanks for taking the time to write up this issue. We will add it to our list of issues to process.

@molivasdat molivasdat added DBOracle hacktoberfest a month-long celebration of open-source software and Developers contribute by completing PRs ImpactLow IntegrationCLI Severity3 TypeBug labels Oct 30, 2020
@kevin-atx kevin-atx removed the hacktoberfest a month-long celebration of open-source software and Developers contribute by completing PRs label Aug 15, 2023
@tati-qalified
Copy link
Contributor

Hello @VGoudkov, sorry for the late response, we're trying to catch up on older tickets in our backlog.

I was able to replicate this issue both with Liquibase version 4.1.1 and 4.23.0, and with a more recent version of Oracle.

I will be forwarding this to the development team so they can evaluate how to move forward.

Thank you,
Tatiana

@hel1e
Copy link

hel1e commented Sep 25, 2023

In addition Oracle Queue tables are generated as normal tables.

Oracle queue tables must be created using sys.dbms_aqadm.create_queue_table. It would be better to exclude them from generateChangelog rather than generating wrong ddl for them.

All queue tables are found in the oracle data dictionary views dba_queue_tables (all_queue_tables / user_queue_tables).

@filipelautert filipelautert self-assigned this Oct 18, 2023
@filipelautert
Copy link
Collaborator

Since Liquibase v4.19.0 we have a new createTable attribute called tableType . To solve @VGoudkov I'll try to fix snapshot so it generates the table as
<createTable tableName="HT_AAA" tableType="GLOBAL TEMPORARY">

For @hel1e case, I think the best case would be to ignore those tables. What do you think?

@filipelautert filipelautert linked a pull request Oct 19, 2023 that will close this issue
3 tasks
@hel1e
Copy link

hel1e commented Oct 20, 2023

Yes, I think it is better if you ignore objects you don't handle instead of creating a changelog which will produce the wrong result. But if you could also just add a comment in the generated changelog, or a summary report telling which objects have been ignored, that would be quite helpful!

I have also discovered a few other Oracle related things that are not supported correctly by generate-changelog:
partitioned tables (and indexes) -> are created as non-partitioned
bitmap indexes -> are created as ordinary indexes
indexes on virtual columns -> the create index statement fails, I guess it tries to create a function-based index instead.

@hel1e
Copy link

hel1e commented Oct 31, 2023

@filipelautert I took a look at your code change, and added a comment to the change you made to liquibase-standard/src/main/java/liquibase/snapshot/JdbcDatabaseSnapshot.java.

You don't actually filter out the queue-tables here as far as I can see. You will need to also add a where clause:
where q.QUEUE_TABLE is null

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

8 participants