Bigint values are converted to string in JSON
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 8.7k
- Forks
- 374
- Avg merge
- 11d 16h
- Merged PRs (30d)
- 1
Description
I have window function which uses ROW_NUMBER. It returns bigint, but postgres.js converts it into a string. However, id field, which is int, is, in fact, a number in JSON:
SELECT row_number() over (order by id) * 100 as row_num,
id
FROM clients.client;
PostgreSQL shows that row_num is bigint and id is int:
If I explicitly convert to int, then all goes fine:
SELECT (row_number() over (order by id) * 100) :: int as row_num,
id
FROM clients.client;
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 tracing PostgreSQL type decoding for bigint and compare it with int results for the shown ROW_NUMBER query. Clarify the expected JSON representation, then add a regression test for the query and verify that the agreed behavior is consistent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, postgresql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100