Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUCdx-0003vD-6k for pgsql-bugs@arkaria.postgresql.org; Wed, 07 Apr 2021 18:11:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUCdw-00089u-4c for pgsql-bugs@arkaria.postgresql.org; Wed, 07 Apr 2021 18:11:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1lUCdv-00089n-SG for pgsql-bugs@lists.postgresql.org; Wed, 07 Apr 2021 18:11:07 +0000 Received: from mail-ej1-x635.google.com ([2a00:1450:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from <9erthalion6@gmail.com>) id 1lUCdp-0004In-C3 for pgsql-bugs@lists.postgresql.org; Wed, 07 Apr 2021 18:11:06 +0000 Received: by mail-ej1-x635.google.com with SMTP id u21so29168390ejo.13 for ; Wed, 07 Apr 2021 11:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=zI/a1WeNp6I9Gc+vGNPXn1WSwIgdNMDSNZB+PSplay8=; b=cDPTBpr93Yi5jL9/BgUXeoRHC6FWcQoKfUzIQ77vgtLhZlBJ5RBRzfW12hyEc6DjNH eZGalruIpgyyFnUdhxQ3XF+lU68u6kl5qpefjUCmzpTqmte/KEEfK3/HY5tfSmyQqemJ J32oLHdC1k6/T4OE2XyzvSRg/6y5g7OgrATey0gRTsiNAu1SgQcU6JUgzBckrocwUzE1 YyxU7DNGd8J4K0MPQarSsEtolepnJ54TlLF9Esg6wDsjx/UajrVTvgIodLbD0O+TgeGv /4l6RhsHRx8vLgxtuxnHke94dxl8+2pey3J/RLTswWbjvhRoR/kLcYnmMV2j6tYdId2k quDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=zI/a1WeNp6I9Gc+vGNPXn1WSwIgdNMDSNZB+PSplay8=; b=OYTkLEwyMvql4O4zIgAMYaE6gHhg5vseRQpX81MHbWwzxDhLdk+G+N+QkXT8sOwnjN XQ/HbB7bCUALFvdr0rHbHZu467Z62ORbypVpP7H0bfNTfO63kGv87Y/3cmTGvWbTCw4k 9GMNexqmI26nuS4kNSgeManX6Te8d3vHv2gCcjRnqpeHMfmfiClRJejIKjijBL9G3w/R UwIiBaW/1ndaPxnX1IuA7nhK+jMXU1VsO7mhY7cBZE+n2tqaPzUbULzE4wX1068i43SY eyN+Sce26QDFUbsat0cT8d9bFeSkQHbfx3LZH5GC8ePeIMLyZsV41LDH3XKwa56ZApCh 2KyQ== X-Gm-Message-State: AOAM532yZ/xdKi12M9pnGeGfvK6hhJ0MzsPZnobGr5PqOcvEY5CueGNB fDF+VaAo2O25uX4er+ZmokU= X-Google-Smtp-Source: ABdhPJwtEi3ro0AqZ9iK3ZHFUJJUwgqYXvZ8FeRhOgg/80A/N4c8cKcoC/zaFYuAGFtNzLfU/dVBZA== X-Received: by 2002:a17:906:1182:: with SMTP id n2mr5311588eja.234.1617819059567; Wed, 07 Apr 2021 11:10:59 -0700 (PDT) Received: from localhost (dslb-094-222-016-066.094.222.pools.vodafone-ip.de. [94.222.16.66]) by smtp.gmail.com with ESMTPSA id j6sm13325294edw.73.2021.04.07.11.10.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 07 Apr 2021 11:10:58 -0700 (PDT) Date: Wed, 7 Apr 2021 20:11:05 +0200 From: Dmitry Dolgov <9erthalion6@gmail.com> To: "Poot, Bas (B.J.)" Cc: "pgsql-bugs@lists.postgresql.org" Subject: Re: XX000: unknown type of jsonb container. Message-ID: <20210407181105.lmi7hgifwzs3eeee@localhost> References: <534fca83789c4a378c7de379e9067d4f@politie.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <534fca83789c4a378c7de379e9067d4f@politie.nl> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > 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.