postgres icon indicating copy to clipboard operation
postgres copied to clipboard

Unexpected token JSON

Open molotow11 opened this issue 1 year ago • 2 comments

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

molotow11 avatar Feb 07 '24 10:02 molotow11

Same issue when array_agg is used on JSON column with null value.

intelocate-admin avatar Feb 16 '24 03:02 intelocate-admin

Another probably not related issue, bool[] paramaters do not work.

await sqlSELECT ${[true, false]}::bool[];

PostgresError: cannot cast type boolean to boolean[]

intelocate-admin avatar Feb 16 '24 14:02 intelocate-admin