PhilWaldmann / openrecord

Make ORMs great again!
https://openrecord.js.org
MIT License
486 stars 38 forks source link

Postgresql unknown column type bug #71

Closed arthurfranca closed 6 years ago

arthurfranca commented 6 years ago

Hello, i was upgrading from v1 to v2 and found some issues.

https://github.com/PhilWaldmann/openrecord/blob/7e44a33c859447c7af1510efdf121920bd8283d2/lib/stores/postgres/attributes.js#L6-L7 According to https://www.postgresql.org/docs/current/static/datatype-numeric.html, 'small int' should be smallint 'big int' should be bigint Didn't test it but i think code should also have keys smallserial, serial, bigserial as 'integer'.

I also get "relation ... does not exist" errors for tsvector and geometry (from PostGIS extension) type columns. So maybe you could return 'string' instead of null at line 249 for unknown/not listed column types https://github.com/PhilWaldmann/openrecord/blob/7e44a33c859447c7af1510efdf121920bd8283d2/lib/stores/postgres/attributes.js#L242-L249

PhilWaldmann commented 6 years ago

Hey @arthurfranca

good point! Actually I didn't test with the postgis extension. I'll take a look at it today or tomorrow. Or if you are faster, a PR is always welcome!

Thanks, Philipp

PhilWaldmann commented 6 years ago

version 2.2 adds more numeric types + all geometric types + fixes. The default type for unknown postrges types is now string. So there shouldn't any errors with postgres extensions and new types.