Skip to content

fix(metadata): map PostgreSQL money to decimal#4559

Open
hutiefang76 wants to merge 1 commit into
DataLinkDC:devfrom
hutiefang76:fix/dinky-postgresql-money-type
Open

fix(metadata): map PostgreSQL money to decimal#4559
hutiefang76 wants to merge 1 commit into
DataLinkDC:devfrom
hutiefang76:fix/dinky-postgresql-money-type

Conversation

@hutiefang76

Copy link
Copy Markdown

Purpose

Fixes #4557.

PostgreSQL money columns were falling through the metadata type converter and being reported as STRING. This maps money together with the other PostgreSQL numeric types so it is exposed as Dinky DECIMAL metadata.

Changes

  • Treat PostgreSQL money as a decimal-compatible type in PostgreSqlTypeConvert.
  • Avoid dereferencing a null precision while checking the existing PostgreSQL decimal precision guard.
  • Add a regression test for money metadata conversion.

Verification

JAVA_HOME=$(/usr/libexec/java_home -v 17) PATH="$JAVA_HOME/bin:$PATH" \
  ./mvnw -pl dinky-metadata/dinky-metadata-postgresql -am \
  -Dtest=PostgreSqlDriverTest#convertMoneyTypeToDecimal \
  -DfailIfNoTests=false test

JAVA_HOME=$(/usr/libexec/java_home -v 17) PATH="$JAVA_HOME/bin:$PATH" \
  ./mvnw -pl dinky-metadata/dinky-metadata-postgresql -am \
  -Dtest=PostgreSqlDriverTest \
  -DfailIfNoTests=false test

JAVA_HOME=$(/usr/libexec/java_home -v 17) PATH="$JAVA_HOME/bin:$PATH" \
  ./mvnw -pl dinky-metadata/dinky-metadata-postgresql -am test

All three commands passed locally.

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.

[Bug] [Flink DDL] Wrongly mapped PostgreSQL type money to java.lang.String

1 participant