You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To fix this, Zapatos would need to reference the PostgresInterval type exported by postgres-interval for Selectable.
Another more complicated consideration would be to allow customizing the default types used per data type, as the default parsers can be overridden at runtime (and there are legit reasons to do so, as some are legacy mistakes that won't be changed until a new major version of pg, e.g. numeric arrays are parsed like float arrays while numeric is parsed as a string and money arrays are parsed as string arrays, or plain dates are parsed as JS Date objects which shifts dates due to using using the local timezone, or to use newer JS features like BigInt for int8). It could work with a file like Zapatos generates for custom domain types that the user can edit. This would also make Zapatos more ready to deal with different versions of pg/pg-types where default parsers are set to change, e.g. date is parsed as a string in the newest version of pg-types, numeric arrays are fixed, and ranges are represented as a PostgresRange object.
In any case though I think the default should correctly represent what the latest version of pg does by default.
The text was updated successfully, but these errors were encountered:
When using
Selectable
, the columns are not coerced intojsonb
like inJSONSelectable
, but parsed to whatever parsers registered withpg
.Selectable
is wrong with some default parsers registed bypg
. It correctly typestimestamptz
asDate
according to the default date parser, butinterval
for example is parsed as aPostgresInterval
object, but inSelectable
it is typed asstring
. See https://github.com/brianc/node-pg-types/blob/v2.2.0/lib/textParsers.js#L199 and https://github.com/bendrucker/postgres-interval/blob/v1.2.0/index.d.ts (these are the dependency versions of the current latest version ofpg
).To fix this, Zapatos would need to reference the
PostgresInterval
type exported bypostgres-interval
forSelectable
.Another more complicated consideration would be to allow customizing the default types used per data type, as the default parsers can be overridden at runtime (and there are legit reasons to do so, as some are legacy mistakes that won't be changed until a new major version of
pg
, e.g.numeric
arrays are parsed like float arrays whilenumeric
is parsed as a string andmoney
arrays are parsed as string arrays, or plaindate
s are parsed as JSDate
objects which shifts dates due to using using the local timezone, or to use newer JS features likeBigInt
forint8
). It could work with a file like Zapatos generates for custom domain types that the user can edit. This would also make Zapatos more ready to deal with different versions ofpg
/pg-types
where default parsers are set to change, e.g.date
is parsed as a string in the newest version ofpg-types
,numeric
arrays are fixed, and ranges are represented as aPostgresRange
object.In any case though I think the default should correctly represent what the latest version of
pg
does by default.The text was updated successfully, but these errors were encountered: