Re: XX000: unknown type of jsonb container.

From: Dmitry Dolgov <9erthalion6(at)gmail(dot)com>
To: "Poot, Bas (B(dot)J(dot))" <bas(dot)poot(at)politie(dot)nl>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: XX000: unknown type of jsonb container.
Date: 2021-04-07 18:11:05
Message-ID: 20210407181105.lmi7hgifwzs3eeee@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> On Wed, Apr 07, 2021 at 10:59:31AM +0000, Poot, Bas (B.J.) wrote:
>
> Finally! I have a testcase for you guys. This is my query to generate the data.
> select *
> into tmp_bug2
> from (
> select 'thing' as logical_name
> , 'thing' as display_name
> , 'thing' as operation
> , '{"unit": "Our special Unit", "some.place": "placename", "place_of_birth": "Over the rainbow", "How_secret_is_it": "Level 1", "Does.it.shoot": "YES!"}'::jsonb as filtur
> from generate_series(1, 302443)
> ) t1;
>
> And this is the query that generates the error.
>
> select
> display_name
> ,'' as x
> ,filtur
> ,jsonb_each_text(filtur) as x
> ,to_jsonb(jsonb_each_text(filtur)) as frows
> ,array(SELECT jsonb_object_keys(filtur)) as objectkeys
> from tmp_bug2
> order by logical_name;
>
> Notice that when you generate not 302443 but 302442 rows, it works perfectly fine.

Thanks for posting the test case, I can reproduce it on the master
branch as well (also without the second call to jsonb_each_text in line
with to_jsonb). Interesting, it looks like for unclear to me reasons the
argument, evaluated in ExecMakeFunctionResultSet for jsonb_each_text,
contains value from the previous attribute, not jsonb. This makes
iteratorFromContainer complain because both array & object flags are set
in the header. I'll try to investigate, unless someone else will be
faster.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2021-04-08 10:17:50 Re: BUG #16953: OOB access while converting "interval" to char
Previous Message Andres Freund 2021-04-07 16:31:54 Re: BUG #16707: Memory leak