brianc / node-pg-types

Type parsing for node-postgres
271 stars 56 forks source link

please throw when oid is nullish #128

Closed kapouer closed 3 years ago

kapouer commented 3 years ago

Hi

i just had a hard time debugging a stupid mistake:

pg.types.setTypeParser(
  pg.types.builtins.TIMESTAMPZ,
  str => myDateParser(str)
);

which silently fails to call myDateParser. Can you spot the mistake ? It took me a while to get it... so i think it would be nice if setTypeParser(null, ...) threw an error.

bendrucker commented 3 years ago

Totally reasonable, a PR would be appreciated/merged