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

Support default values in the format (0)::real #2836

Merged
merged 1 commit into from
May 13, 2022

Conversation

nvoxland
Copy link
Contributor

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

The current code recognizes 0::real in postgresql, but not (0)::real. Updated the regexp to handle both

Fixes #2833

Things to be aware of

  • Only impacts handling of default values and only in postgresql

Things to worry about

  • Nothing

@github-actions
Copy link

Unit Test Results

  4 512 files  ±  0    4 512 suites  ±0   32m 5s ⏱️ +50s
  4 410 tests +  7    4 196 ✔️ +  7     214 💤 ±0  0 ±0 
52 200 runs  +84  47 192 ✔️ +84  5 008 💤 ±0  0 ±0 

Results for commit fb8f733. ± Comparison against base commit b6fab96.

@kataggart kataggart added this to the NEXT milestone May 12, 2022
@FBurguer FBurguer self-assigned this May 13, 2022
@FBurguer
Copy link

FBurguer commented May 13, 2022

For the PR i checked that liquibase recognized the (0)::real as 0 in postgresql, using the sql provided in the issue:

CREATE TABLE community (
  id text NOT NULL DEFAULT,
  "name" text NULL,
  "number" text NULL,
  division text NULL,
  latitude real DEFAULT (0)::real,
  longitude real DEFAULT (0)::real,
  latilong point NULL DEFAULT '(0,0)'::point,
  created_at timestamptz NULL DEFAULT now(),
  updated_at timestamptz NULL
);

The error does not happend anymore with this sql and i got this output with liquibase snapshot --log-level=info:

Catalog & Schema: postgres / public
    liquibase.structure.core.Index:
        databasechangeloglock_pkey
            columns:
                id
            table: databasechangeloglock
            unique: true

    liquibase.structure.core.PrimaryKey:
        databasechangeloglock_pkey
            backingIndex: databasechangeloglock_pkey
            columns:
                id
            table: databasechangeloglock

    liquibase.structure.core.Table:
        community
            columns:
                created_at
                    defaultValue: now()
                    nullable: true
                    order: 8
                    type: timestamptz
                division
                    nullable: true
                    order: 4
                    type: text
                id
                    nullable: false
                    order: 1
                    type: text
                latilong
                    defaultValue: 0,0
                    nullable: true
                    order: 7
                    type: point
                latitude
                    defaultValue: 0
                    nullable: true
                    order: 5
                    type: float4
                longitude
                    defaultValue: 0
                    nullable: true
                    order: 6
                    type: float4
                name
                    nullable: true
                    order: 2
                    type: text
                number
                    nullable: true
                    order: 3
                    type: text
                updated_at
                    nullable: true
                    order: 9
                    type: timestamptz
            default_tablespace: false


    Liquibase command 'snapshot' was executed successfully.

Liquibase recognizes (0)::real as 0 (as you can see in longitude and latitude defaultavalue).

@nvoxland nvoxland merged commit 674b22f into master May 13, 2022
@nvoxland nvoxland deleted the fix-postgresql-real-snapshot branch May 13, 2022 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

DAT-9663 Liquibase Snapshot/Diff fails on Postgres with datatype "real" with default value "DEFAULT (0)::real"
4 participants