postgres icon indicating copy to clipboard operation
postgres copied to clipboard

infinity value in Postgres timestamp column returns as 'Invalid Date'

Open hanszoons opened this issue 2 years ago • 1 comments

I have a table with a column dat has a date field with a default value of infinity.

CREATE TABLE test (
  id integer NOT NULL GENERATED ALWAYS AS IDENTITY,
  expires timestamp with time zone DEFAULT 'infinity' NOT NULL,
  PRIMARY KEY (id),
);

This works fine within postgres and within query logic, e.g. ... WHERE end_date is > now() to select all rows that are not yet expired. But Postgres.js converts the infinity values to a Date, resulting in an 'Invalid Date' object in javascript.

Shouldn't this be converted to JavaScripts'Infinity? Should i make a custom type (but I need to replicate the existing date conversion somehow too)? How would I approach this?

hanszoons avatar Nov 13 '23 13:11 hanszoons

I am also having this issue

BeeFox-sys avatar Feb 18 '24 04:02 BeeFox-sys