node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

Updating to the newest version of pg-types

Open mwanago opened this issue 4 years ago • 10 comments

Currently, the pg library uses a very old version of pg-types.

Is there something, in particular, that is stopping us from updating to the newest version of the pg-types library?

mwanago avatar May 16 '21 19:05 mwanago

@brianc What do you think?

mwanago avatar Dec 24 '21 01:12 mwanago

I think there are some backwards incompatible changes but I'm fine to do a semver bump and up the version of pg types. I'll start looking into this.

brianc avatar Dec 27 '21 16:12 brianc

I just noticed that we would need the latest version of pg-types to work with date without having it turn into mangled Javascript dates. @brianc were you able to take a look into what those breaking changes would be?

sgronblo avatar Mar 04 '22 01:03 sgronblo

@sgronblo You can always override the date parser before pg-types is upgraded, note.

charmander avatar Mar 04 '22 20:03 charmander

Are there any plans on how to proceed? The old pg-types parses timezone-less timestamps in the system timezone, while the new one parses it as UTC date. One could argue what the right behavior would be, but since most people set their database timezone to UTC it seems to be an improvement. Further proof for that would be https://github.com/sequelize/sequelize/issues/3000, which would also be fixed by updating pg-types in pg.

For now, I could work around this using npm overrides to force pg to resolve to the latest pg-types package.

"overrides": {
  "pg": {
    "pg-types": "^4.0.1"
  }
},

hpohlmeyer avatar Mar 16 '23 15:03 hpohlmeyer

I'd love to see this happen to pick up the new version of postgres-interval that was introduced in https://github.com/brianc/node-pg-types/pull/126!

nwalters512 avatar Dec 05 '23 00:12 nwalters512

the old postgres-date also have some serious performance issues which was mitigated in https://github.com/bendrucker/postgres-date/pull/21, any plan to continue work on this?

tleiroblox avatar Feb 22 '24 09:02 tleiroblox

@tleiroblox Was there some kind of pathological date case that I missed? 3x speedup on parsing doesn’t sound like “serious performance issues”.

charmander avatar Feb 22 '24 10:02 charmander

@tleiroblox Was there some kind of pathological date case that I missed? 3x speedup on parsing doesn’t sound like “serious performance issues”.

For time series data that has date in every row, parseDate old implementation alone could easily cost more than 50% of the cpu cycles pg used, which often become the bottleneck of the whole node application. It's also not memory efficient that can result in more gc (which also lead to cpu usage)

tleiroblox avatar Feb 22 '24 18:02 tleiroblox