Skip to content

Instantly share code, notes, and snippets.

@ankane
Created April 27, 2022 00:02
Show Gist options
  • Save ankane/3470fffd422f57b75e1bd839d4835c5c to your computer and use it in GitHub Desktop.
Save ankane/3470fffd422f57b75e1bd839d4835c5c to your computer and use it in GitHub Desktop.
createdb pgsync_repro1
createdb pgsync_repro2
psql pgsync_repro1 << SQL
CREATE TABLE posts (
id BIGINT PRIMARY KEY,
linked_post_id BIGINT,
FOREIGN KEY (linked_post_id) REFERENCES posts (id)
);
INSERT INTO posts VALUES (1, NULL), (2, 1);
SQL
psql pgsync_repro2 << SQL
CREATE TABLE posts (
id BIGINT PRIMARY KEY,
linked_post_id BIGINT,
FOREIGN KEY (linked_post_id) REFERENCES posts (id)
);
SQL
pgsync --from pgsync_repro1 --to pgsync_repro2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment