-
Notifications
You must be signed in to change notification settings - Fork 667
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
schema diff: foreign keys: wrong schema #5488
Comments
Hi @fjf2002 I have tested the above-mentioned case:
Found no issues, please refer to the screenshot. |
(cannot test currently due to #5507) |
Working on your schema diff is quite cumbersome. It produces quite sophisticated, hard-to-reproduce errors, and I am not aware of automating that, resulting in mouse click orgies for me. Any suggestions to ease my work? By the way, I always suspect the schema diff compares object ids, which can fail if I use different servers. Perhaps there is the problem? Kind of minimal example:Setup up two brand new postgres instances and a pgadmin instance (I did that via docker containers). In the first postgres instance, execute CREATE TABLE foo (i int);
CREATE TABLE bar (j int);
CREATE SCHEMA schema1;
CREATE SCHEMA schema2;
CREATE TABLE schema1.a (
t text PRIMARY KEY
);
CREATE TABLE schema2.b (
t text,
CONSTRAINT fk FOREIGN KEY (t) REFERENCES schema1.a(t)
); In the second postgres instance, execute CREATE SCHEMA schema1;
CREATE SCHEMA schema2;
CREATE TABLE schema1.a (
t text PRIMARY KEY
);
CREATE TABLE schema2.b (
t text
); The schema diff of the two servers will incorrectly suggest ALTER TABLE IF EXISTS schema2.b
ADD CONSTRAINT fk FOREIGN KEY (t)
REFERENCES schema2.a (t) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION; On execution, this will result in: ERROR: relation "schema2.a" does not exist
SQL state: 42P01 |
This is resolved in the latest snapshot build: |
…in the schema diff tool. pgadmin-org#5488
…in the schema diff tool. pgadmin-org#5488
PgAdmin4 Schema Diff generates statements like:
... but the table2 resides in schema2, not schema1!
The text was updated successfully, but these errors were encountered: