Skip to content

Commit

Permalink
fix(postgres): don't crash when no index can be extracted
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Feb 6, 2024
1 parent ac07f21 commit c80e88f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/postgres/src/postgres-schema-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export class PostgresSchemaParser extends SchemaParser {
continue;
}

if (!row.idxname) continue;
const index = table.addIndex(row.idxname, row.unique);

const attnums = row.indkey.split(' ');
Expand All @@ -77,6 +78,7 @@ export class PostgresSchemaParser extends SchemaParser {
WHERE c.oid = ${oid} AND a.attnum = ${attnum} AND NOT a.attisdropped
ORDER BY a.attnum
`);
if (!column || !column.attname) continue;
index.addColumn(column.attname);
}
}
Expand Down

0 comments on commit c80e88f

Please sign in to comment.