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

Postgres relationships fail to import when ONLY keyword is present in ALTER TABLE statements #386

Open
alexemitwise opened this issue Jan 22, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@alexemitwise
Copy link

alexemitwise commented Jan 22, 2025

Describe the bug
When the ONLY keyword is present in ALTER TABLE statements (generated by pg_dump) the foreign key relationships fail to import.

My workaround for the minute is to simply delete all occurrences of the ONLY keyword, so should be fine to add the same step in parser.

Obvious fix once you know but subtle enough to put a lot of people off from using the tool.

To Reproduce
Steps to reproduce the behavior:

  1. Import the following schema sql:
CREATE TABLE foo (
 a int,
)

CREATE TABLE bar (
 b int,
)

ALTER TABLE ONLY foo
ADD CONSTRAINT foo_bar_fkey
FOREIGN KEY (a) REFERENCES bar(b)

ALTER TABLE ONLY bar
ADD CONSTRAINT bar_foo_fkey
FOREIGN KEY (b) REFERENCES foo(a)

Expected behavior
Relationships to be present.

Screenshots

Image

Browser (please complete the following information):

  • OS: macOS
  • Browser Chrome
  • Version 132.0

Additional context
Add any other context about the problem here.

@alexemitwise alexemitwise added the bug Something isn't working label Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant