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

ERD Tool - Primary key constraints is not updated after the checkbox for primary key is unchecked #7476

Closed
petkorutesic opened this issue May 15, 2024 · 3 comments
Assignees
Milestone

Comments

@petkorutesic
Copy link

Changing a primary key constraints or even deleting attributes does not change the constraints in the "Constraints" tab

Removing an attribute does not change the constraints defined on that attribute.

To Reproduce

Steps to reproduce the behavior:

  1. Define the primary key constraint on a table and save the whole project in the ERD Tool.

  2. Double-click on the table in the diagram, and the form for editing table properties will open. The checkbox for the primary key can now be unchecked. However, saving your changes does not exclude the primary key constraints. The primary key constraint can still be found if you open the "Constraints" tab. Moreover, even if we completely remove the attribute on which the primary constraint is defined, the constraint still remains in the "Constraints" tab.

  3. This can cause problems and is annoying if you click on the "Generate SQL" option which generates SQL DDL statements with unwanting constraints or constraints on unexisting attributes.

Expected behavior

It would be natural that the ERD Tools shows a dialogue form to confirm an automatic delete of the primary key constraint if this constraint is removed in the tab "Columns" that contains the list of attributes.

Screenshots

Screenshot 2024-05-15 at 12 52 23

After we remove the attribute with the primary key:
Screenshot 2024-05-15 at 13 48 23

However, the constraint is still there:
Screenshot 2024-05-15 at 13 33 12

Error message if the generated DDL SQL is run

Screenshot 2024-05-15 at 13 53 17

Software

  • MacOS: [OSX Sonoma 14.5 - macOS-14.5-x86_64-i386-64bit]
  • pgAdmin4 Version: 8.6
    NW.js Version: 0.77.0
  • Mode: Desktop
  • Browser: Chromium 114.0.5735.91
@adityatoshniwal
Copy link
Contributor

I can confirm its a bug.

@anilsahoo20 anilsahoo20 self-assigned this May 17, 2024
anilsahoo20 added a commit to anilsahoo20/pgadmin4 that referenced this issue Jun 13, 2024
anilsahoo20 added a commit to anilsahoo20/pgadmin4 that referenced this issue Jun 13, 2024
@anilsahoo20
Copy link
Contributor

I found same issues with Foreign key, Unique and Exclude constraint in Table dialog as well as in ERD tool table dialog. So fixed all the issues for all the constraints except Check constraint.

While testing this please consider looking into the other constraints also.

adityatoshniwal pushed a commit that referenced this issue Jun 17, 2024
… constraints in table object dialog and ERD table dialog. #7476
@adityatoshniwal adityatoshniwal added this to the 8.9 milestone Jun 17, 2024
@pravesh-sharma pravesh-sharma self-assigned this Jun 17, 2024
@pravesh-sharma
Copy link
Contributor

Issue fixed. Verified on snapshot build.

Env:
OS - macOS Sonoma 14.5
Mode - Desktop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants