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

[LB-2110] Fix COLUMN_SIZE for PostgreSQL NUMERIC[] datatype by adding it as unmodifiable data type for PostgresDatabase #2192

Merged
merged 1 commit into from Nov 10, 2021

Conversation

andrulban
Copy link
Contributor

Arrays in Postgres do NOT have size, even if param specified - it is ignored (https://www.postgresql.org/docs/14/arrays.html)

Environment

Liquibase Version:

Liquibase Integration & Version: <Pick one: CLI, maven, gradle, spring boot, servlet, etc.>

Liquibase Extension(s) & Version:

Database Vendor & Version:

Operating System Type & Version:

Pull Request Type

  • Bug fix (non-breaking change which fixes an issue.)
  • Enhancement/New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

A clear and concise description of the issue being addressed. Additional guidance here.

  • Describe the actual problematic behavior.
  • Ensure private information is redacted.

Steps To Reproduce

List the steps to reproduce the behavior.

  • Please be precise and ensure private information is redacted
  • Include things like
    • Files used - sql scripts, changelog file(s), property file(s), config files, POM Files
    • Exact commands used - CLI, maven, gradle, spring boot, servlet, etc.

Actual Behavior

A clear and concise description of what happens in the software before this pull request.

  • Include console output if relevant
  • Include log files if available.

Expected/Desired Behavior

A clear and concise description of what happens in the software after this pull request.

Screenshots (if appropriate)

If applicable, add screenshots to help explain your problem.

Additional Context

Add any other context about the problem here.

Fast Track PR Acceptance Checklist:

Need Help?

Come chat with us on our discord channel

… it as unmodifiable data type for PostgresDatabase

Arrays in Postgres do NOT have size, even if param specified - it is ignored (https://www.postgresql.org/docs/14/arrays.html)
Copy link
Contributor

@StevenMassaro StevenMassaro left a comment

Choose a reason for hiding this comment

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

I question the necessity of this change, despite the fact that it looks to be done well. The Postgres documentation says explicitly that you can use array size identifiers:

The syntax for CREATE TABLE allows the exact size of arrays to be specified

Additionally, the CREATE TABLE statement in LB-2110 that is supposed to cause a problem executes fine in Postgres. I personally think that this change is not needed. I'd like to hear some other opinions.

Updated Rows	0
Query	CREATE TABLE "public"."contacts2" ("id" INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL, "name" VARCHAR(100), "phones" TEXT[], "po_box" NUMERIC[131089], CONSTRAINT "contacts2_pkey" PRIMARY KEY ("id"))
Finish time	Mon Nov 08 08:09:19 CST 2021

@andrulban
Copy link
Contributor Author

I question the necessity of this change, despite the fact that it looks to be done well. The Postgres documentation says explicitly that you can use array size identifiers:

The syntax for CREATE TABLE allows the exact size of arrays to be specified

Additionally, the CREATE TABLE statement in LB-2110 that is supposed to cause a problem executes fine in Postgres. I personally think that this change is not needed. I'd like to hear some other opinions.

Updated Rows	0
Query	CREATE TABLE "public"."contacts2" ("id" INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL, "name" VARCHAR(100), "phones" TEXT[], "po_box" NUMERIC[131089], CONSTRAINT "contacts2_pkey" PRIMARY KEY ("id"))
Finish time	Mon Nov 08 08:09:19 CST 2021

Hi Steve, it allows but it ignores it and we even can't get info about it from DB later because this limit is ignored during table creation

https://www.postgresql.org/docs/14/arrays.html

image

Copy link
Contributor

@StevenMassaro StevenMassaro left a comment

Choose a reason for hiding this comment

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

Pretty strange that Postgres doesn't even store that array size even if it doesn't use it. In any case, I don't have a good reason not to approve merging this. Thanks!

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.

PostgreSQL NUMERIC[] datatype is not generated properly with the generateChangeLog command
3 participants