porsager / porsager/postgres

Unexpected token JSON

Open
#800 2 comments 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

Hi, Guys!

I have an issue with query like this:

        SELECT i.*, 
          array_agg(m.name) as motifs,
          array_agg(m.global_art_style) as global_art_style,
          array_agg(m.styles) as styles 
        FROM public."Location" as i
          LEFT JOIN public."Motif" AS m ON m.location = i.id
          WHERE 1=1
        GROUP BY i.id
        ORDER BY id ASC

Inside array_agg fields I have text with possible NULL values, it is fine in PgAdmin and I see just NULL values, but with your library the query is failed with error:
Unexpected token N in JSON at position 0

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, test, or entry point is named. Reproduce the shown PostgreSQL query through Postgres.js and trace how array_agg results containing NULL are decoded; the expected handling of those values needs clarification before a completion check can be defined.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.