pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: david@daily-harvest.com
Subject: BUG #15242: JSON functions not recognizing JSON
Date: Thu, 14 Jun 2018 17:50:44 +0000
Message-ID: <152899864499.24805.18088125700685635313@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15242
Logged by:          David
Email address:      david@daily-harvest.com
PostgreSQL version: 9.6.6
Operating system:   Mac / DBeaver
Description:        

I get this error:   SQL Error [22023]: ERROR: cannot deconstruct an array as
an object

when running the statement below because the JSON_EACH function doesn't
recognize the JSON. If I remove the json_each function the query runs fine
and executes JSON_ARRAY_LENGTH on the same variable, even though both
functions take json.

WITH sample_text AS 
(
SELECT TEXT '[{"id":11,"name":"Chocolate +
Blueberry","sku":"11-CHOBLU"},{"id":11,"name":"Chocolate +
Blueberry","sku":"11-CHOBLU"}]' AS txt
)
SELECT json_array_length(txt::json), json_each(txt::json) FROM sample_text



view thread (3+ messages)  latest in thread

Message-ID: <152899864499.24805.18088125700685635313@wrigleys.postgresql.org>
Permalink:  ../152899864499.24805.18088125700685635313@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/152899864499.24805.18088125700685635313@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, david@daily-harvest.com
  Subject: Re: BUG #15242: JSON functions not recognizing JSON
  In-Reply-To: <152899864499.24805.18088125700685635313@wrigleys.postgresql.org>
  References: <152899864499.24805.18088125700685635313@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox