BUG #15242: JSON functions not recognizing JSON - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15242: JSON functions not recognizing JSON
Date
Msg-id 152899864499.24805.18088125700685635313@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #15242: JSON functions not recognizing JSON  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: BUG #15242: JSON functions not recognizing JSON  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-bugs
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


pgsql-bugs by date:

Previous
From: Euler Taveira
Date:
Subject: Re: BUG #15230: "Logical decoding" is not sensitive to clientencoding setting
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #15242: JSON functions not recognizing JSON