Skip to content

PLAT-82: Add PostgreSQL support to reference application modules#162

Open
wikumChamith wants to merge 1 commit intoBahmni:masterfrom
wikumChamith:PLT-82
Open

PLAT-82: Add PostgreSQL support to reference application modules#162
wikumChamith wants to merge 1 commit intoBahmni:masterfrom
wikumChamith:PLT-82

Conversation

@wikumChamith
Copy link
Contributor

@wikumChamith wikumChamith commented Oct 3, 2024

Fixes PostgreSQL compatibility issues in the liquibase.xml

https://openmrs.atlassian.net/browse/PLAT-82

@CLAassistant
Copy link

CLAassistant commented Oct 3, 2024

CLA assistant check
All committers have signed the CLA.

@wikumChamith wikumChamith changed the title PLT-82: Add PostgreSQL support to reference application modules PLAT-82: Add PostgreSQL support to reference application modules Oct 8, 2024
@wikumChamith
Copy link
Contributor Author

@angshu can you take a look at this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for the update! I would recommend reconsidering the use of ANY in this changeset. I checked the checksum of the below changeSet, and got entirely different ones (screenshot attached below).

My understanding is that if raw SQL (...) is used instead of structured XML (), Liquibase does not normalize it across different databases and the database might generate different checksums. I recommend avoiding ANY as this will prevent detection of future accidental changes to the changeset.

Let me know your thoughts, and thanks for your effort on this!

cc: @angshu, @mohan-13

Screenshot 2025-02-07 at 3 03 06 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find any use of ANY. Could you point out where it's being used? Thanks!

@wikumChamith wikumChamith requested a review from rahu1ramesh March 4, 2025 09:52
@mherman22
Copy link

Hey @wikumChamith , so with these changes the Initializer complains with the following error: Caused by: org.postgresql.util.PSQLException: ERROR: relation "speciality_id_seq" does not exist

The error i believe occurred because the Hibernate mapping explicitly referenced a sequence named speciality_id_seq, but PostgreSQL did not have such a sequence. In PostgreSQL, when a column is defined using autoIncrement="true" in Liquibase, it translates to GENERATED BY DEFAULT AS IDENTITY, which creates a sequence with an auto-generated name (e.g., appointment_speciality_speciality_id_seq). Since no sequence named speciality_id_seq existed, PostgreSQL threw a relation "speciality_id_seq" does not exist error during entity persistence.

The fix was to remove the explicit sequence name from the Hibernate mapping and rely on the native ID generation strategy by changing:

<generator class="native">
    <param name="sequence">speciality_id_seq</param>
</generator>

to simply:

<generator class="native"/>

Also did the above step for

<generator class="native">
<param name="sequence">appointment_service_id_seq</param>
</generator>
in order to fix Caused by: org.postgresql.util.PSQLException: ERROR: relation "appointment_service_id_seq" does not exist

Here are the logs just incase you need to look them over: https://paste.ubuntu.com/p/RYWwsD3ktS/

cc: @dkayiwa

@angshu
Copy link
Member

angshu commented Oct 25, 2025

Just following up on this. @wikumChamith @mherman22 any resolution to this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants