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

PostgreSQL - support of "money" data type in diffChangeLog #3213

Open
LonwoLonwo opened this issue Aug 29, 2022 · 3 comments
Open

PostgreSQL - support of "money" data type in diffChangeLog #3213

LonwoLonwo opened this issue Aug 29, 2022 · 3 comments

Comments

@LonwoLonwo
Copy link
Contributor

Environment

Liquibase Version: Current version (4.15)

Liquibase Extension(s) & Version: None

Database Vendor & Version: PostgreSQL 13

Description

Money data type modifies to DECIMAL in diffChangeLog.

I compare two schemas.
The first one (test1) can have as an example this table:

CREATE TABLE test1.testmoney (
	col1 money NOT NULL);

And the second schema (test2) does not have this table.

In this case, I get this result from Liquibase:

CREATE TABLE test2.testmoney (
	col1 DECIMAL NOT NULL);

DECIMAL - not money.

Or I have a table with a money column in the test1:

CREATE TABLE test1.testmoney (
	col1 money NOT NULL,
        billingnew numeric NOT NULL));

And a table with a numeric column in schema test2:

CREATE TABLE test2.testmoney (
	col1 numeric NOT NULL,
        billingnew numeric NOT NULL));

In this case, I get this result:

ALTER TABLE test2."testmoney" ALTER COLUMN col1 TYPE DECIMAL USING (col1::DECIMAL);

PostgreSQL supports money data type, so I think, it can be supported by Liquibase: https://www.postgresql.org/docs/current/datatype-money.html

Possible Solution:

https://github.com/liquibase/liquibase/blob/master/liquibase-core/src/main/java/liquibase/datatype/core/CurrencyType.java

This issue can be fixed in the CurrencyType - just add the PostgreDatabase case.

@LonwoLonwo
Copy link
Contributor Author

This ticket can be related to this one: #1190
But I'm not sure.

@kataggart
Copy link
Contributor

@LonwoLonwo talked with team about this; we can look into potential better handling of decimals/currency in snapshots, but unfortunately we don't have capacity to review at the moment. Can you help me better understand your specific use case and the urgency (if any) on your side? Many thanks!

@LonwoLonwo
Copy link
Contributor Author

Hello @kataggart

I think that money data type <> decimal data type in PostgreSQL. They are close, but not equals.
I can't provide specific cases, sorry. This request is from our users.

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

No branches or pull requests

2 participants