Improper handling of `to_timestamp` times
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
Code
await sql`
INSERT INTO table_name
${sql(inputData)}
`
Postgres.js debug output
SQL:
INSERT INTO table_name
("start_time")values($1)
Params: [ 'to_timestamp(3213213210)' ]
node:internal/process/promises:289
triggerUncaughtException(err, true /* fromPromise */);
^
RangeError: Invalid time value
at Date.toISOString (<anonymous>)
at Object.serialize
Direct postgres query
select to_timestamp(3213213210); => 2071-10-27 18:13:30.000 -0500
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the SQL-template example and trace the serialization path shown at Object.serialize, comparing it with the direct PostgreSQL to_timestamp query. Done means the reported input no longer raises RangeError and its database behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs, postgresql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100