Skip to content

Free, simple, and intuitive online database diagram editor and SQL generator.

Fix primary key assignment from out of line PK constraints in pg

1ilit2704a007b826
diff --git a/src/utils/importSQL/postgres.js b/src/utils/importSQL/postgres.js
index 77ba39b0..3ac7a4b5 100644
--- a/src/utils/importSQL/postgres.js
+++ b/src/utils/importSQL/postgres.js
@@ -102,7 +102,7 @@ export function fromPostgres(ast, diagramDb = DB.GENERIC) {
if (d.constraint_type === "primary key") {
d.definition.forEach((c) => {
table.fields.forEach((f) => {
- if (f.name === c.column && !f.primary) {
+ if (f.name === c.column.expr.value && !f.primary) {
f.primary = true;
}
});