porsager / porsager/postgres

`NULL` in smallint array mapped to `NaN` instead of `null`

Open
#1,049 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
8.7k
Forks
374
Avg merge
11d 16h
Merged PRs (30d)
1

Description

I have a table with a column of type smallint[]. When a value within the array is NULL, Postgres.js maps it to NaN. I would like it to map to a JS null instead.

This would match the behaviour when a whole column's value is NULL, and allow me to coalesce the null value in JS.

Is there a way to configure this? Could the current behaviour be considered a bug?

Thanks,
Adam

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No file or test is named in the issue. Reproduce the behavior with a PostgreSQL smallint[] containing a NULL through Postgres.js, then locate the array value decoding entry point; done means NULL elements become JavaScript null while whole-column NULL behavior remains unchanged.

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
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.