Skip to content

Conversation

nvoxland
Copy link
Contributor

@nvoxland nvoxland commented Jul 9, 2021

Fixes #1933


Dev Handoff Notes (Internal Use)

Links

Testing

Dev Verification

Liquibase command 'update' was executed successfully.

Test Requirements (Liquibase Internal QA)

Manual Tests

Use the changelog attached to this ticket to run your tests against a Postgres database.

  • Setup: Deploy the changes to create tables
    • liquibase update --changelog-file lb1976-changelog.xml --labels createTable

Verify update of a dropPrimaryKey with an auto-generated, camelCase PK name is successful._

  • liquibase update --changelog-file lb1976-changelog.xml --labels dropAutoNamedPK

Verify update of a addPrimaryKey with a camelCase named PK is successful._

  • liquibase update --changelog-file lb1976-changelog.xml --labels addNamedPK

Verify update of a dropPrimaryKey with a camelCase named PK is successful._

  • liquibase update --changelog-file lb1976-changelog.xml --labels dropNamedPK

Automated Test Requirements

  • No new functional automated tests required.
  • A liquibase/liquibase-test-harness test is required.
    • Add a changelog with changes sets in the attached changelog with changeset author “gjvoosten.”
      • liquibase-test-harness/src/main/resources/liquibase/harness/change/changelogs/postgresql.
    • Add the JSON snapshot for test validation:
      • src/main/resources/liquibase/harness/change/expectedSnapshot/
    • Add the generated SQL for test validation:
      • src/main/resources/liquibase/harness/change/expectedSql/

Validate that dropPrimaryKey does not fail due to camelCasing of the autogenerated PK name.

┆Issue is synchronized with this Jira Bug by Unito

@gjvoosten
Copy link
Contributor

@nvoxland @suryaaki2 Any progress on this? It needs this additional update to pass the tests:

diff --git a/liquibase-core/src/test/java/liquibase/verify/saved_state/compareGeneratedSqlWithExpectedSqlForMinimalChangesets/dropPrimaryKey/postgresql.sql b/liquibase-core/src/test/java/liquibase/verify/saved_state/compareGeneratedSqlWithExpectedSqlForMinimalChangesets/dropPrimaryKey/postgresql.sql
index 660ffa303..45aca4267 100644
--- a/liquibase-core/src/test/java/liquibase/verify/saved_state/compareGeneratedSqlWithExpectedSqlForMinimalChangesets/dropPrimaryKey/postgresql.sql
+++ b/liquibase-core/src/test/java/liquibase/verify/saved_state/compareGeneratedSqlWithExpectedSqlForMinimalChangesets/dropPrimaryKey/postgresql.sql
@@ -6,5 +6,5 @@ BEGIN
     FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc
     WHERE CONSTRAINT_TYPE = 'PRIMARY KEY'
       AND TABLE_NAME = 'person' AND TABLE_SCHEMA = 'null';
-    EXECUTE 'alter table null.person drop constraint ' || constraint_name;
+    EXECUTE 'alter table null.person drop constraint "' || constraint_name || '"';
 END $$;;

As I wrote in #1933 (comment), it otherwise works fine.

@gjvoosten
Copy link
Contributor

@nvoxland @suryaaki2 Anything I can do to help speed this up?

@nvoxland nvoxland changed the base branch from 4.4.x to master September 24, 2021 19:57
@gjvoosten
Copy link
Contributor

@nvoxland @suryaaki2 Any chance this will get merged & released soon'ish? It's really blocking us from updating…

@sync-by-unito sync-by-unito bot assigned yodzhubeiskyi and unassigned nvoxland Oct 27, 2021
@nvoxland nvoxland merged commit c65d233 into master Oct 29, 2021
@nvoxland nvoxland deleted the postgresql-drop-pk branch October 29, 2021 16:47
@nvoxland
Copy link
Contributor Author

It will be going out in the upcoming 4.6.0 release

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.

dropPrimaryKey fails on PostgreSQL
4 participants