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

Ensures that Postgresql works with blob types bytea and oid (large objects) #3381

Conversation

filipelautert
Copy link
Collaborator

Impact

  • Bug fix (non-breaking change which fixes expected existing functionality)
  • Enhancement/New feature (adds functionality without impacting existing logic)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Postgresql defines 2 column types to handle blob types: bytea and large objects that must be declared as "oid". According to postgresql documentation, both must use different jdbc methods (https://jdbc.postgresql.org/documentation/binary-data/) .

Until Liquibase 4.13, bytea was supported. But #605 changed the methods to support large objects instead of bytea.

This fix validates the column type and uses the appropriated jdbc method depending on it.

Things to be aware of

  • A column cache has been created to make sure that snapshot data for a column is requested only once
  • After this patch, both oid and bytea column types should work.

Things to worry about

  • NA

Additional Context

@github-actions
Copy link

github-actions bot commented Oct 17, 2022

Unit Test Results

  4 668 files  ±  0    4 668 suites  ±0   33m 46s ⏱️ -42s
  4 642 tests +  1    4 416 ✔️ +1     226 💤 ±  0  0 ±0 
54 708 runs  +12  49 634 ✔️ +1  5 074 💤 +11  0 ±0 

Results for commit e01a198. ± Comparison against base commit ea43d36.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@nvoxland nvoxland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes make sense, and adds integration tests

Copy link
Contributor

@XDelphiGrl XDelphiGrl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Liquibase 4.12 introduced a regression in handling Postgres blob types. This regression caused inserts of data into Postgres columns of datatype of bytea to fail due to Liquibase treating the data as a large object (oid). Liquibase now supports Posgres bytea and Postgres oid blob types.

  • New integration tests added.
  • No additional testing necessary.

APPROVED

@nvoxland nvoxland merged commit edbdf29 into master Nov 8, 2022
@nvoxland nvoxland deleted the 3165-problem-inserting-valueblobfile-into-bytea-column-postgres branch November 8, 2022 07:06
@kevin-atx kevin-atx added this to the 1NEXT milestone Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Problem inserting valueBlobFile into bytea column postgres
5 participants