rmp135 / sql-ts

Generate TypeScript interfaces from a SQL database.
MIT License
477 stars 65 forks source link

Error: column pg_attribute.attidentity does not exist for postgres 9.6 #133

Closed jcyh0120 closed 1 year ago

jcyh0120 commented 1 year ago

pg_attribute.attidentity for postgres 9.6 shows an error column pg_attribute.attidentity does not exist

https://github.com/rmp135/sql-ts/blob/0aec60cdc59ef4b20e9d78c626cb88f64c1b05a5/src/Adapters/postgres.ts#L65

Relace node_modules/@rmp135/sql-ts/dist/Adapters/postgres.js pg_attribute.atthasdef OR pg_attribute.attidentity <> '' AS hasDefault, to pg_attribute.atthasdef AS hasDefault,

Work for me, but I don't know if it's a right way.

rmp135 commented 1 year ago

Postgres 9.6 was released in 2016 and last supported in 2021, I can't reasonably keep support for this version. It looks like attidentity was added in version 10. Removing the condition might cause identity type columns optionality to generate incorrectly.