Re: SQL/JSON: JSON_TABLE

From: Erik Rijkers <er(at)xs4all(dot)nl>
To: Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, David Steele <david(at)pgmasters(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Dmitry Dolgov <9erthalion6(at)gmail(dot)com>, Oleg Bartunov <obartunov(at)gmail(dot)com>, Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>
Subject: Re: SQL/JSON: JSON_TABLE
Date: 2021-03-30 21:58:23
Message-ID: 19181987.22943.1617141503618@webmailclassic.xs4all.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


> On 2021.03.30. 22:25 Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> wrote:
>
>
> On 30.03.2021 19:56, Erik Rijkers wrote:
>
> >> On 2021.03.27. 02:12 Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru> wrote:
> >>
> >> Attached 47th version of the patches.
> > Hi,
> >
> > Apply, build all fine. It also works quite well, and according to specification, as far as I can tell.
> >
> > But today I ran into:
> >
> > ERROR: function ExecEvalJson not in llvmjit_types.c
> >
> > I think that it is caused by:
> >
> > set enable_bitmapscan = off;
> >
> > (I installed llvm a few days ago. llvm-3.9-dev on this debian stretch).
> >
> >
> > This is the test sql I concocted, which runs fine with enable_bitmapscan on (the default):
> >
> > select jt1.*
> > from myjsonfile100k as t(js, id)
> > , json_table(
> > t.js
> > , '$' columns (
> > "lastname" text path '$. "lastname" '
> > , "firstname" text path '$. "firstname" '
> > , "date" text path '$. "date" '
> > , "city" text path '$. "city" '
> > , "country" text path '$. "country" '
> > , "name 0(1)" text path '$. "array"[0] '
> > , "name 4(5)" text path '$. "array"[4] '
> > , "names" text[] path '$. "array" '
> > , "randfloat" float path '$. "random float" '
> > )
> > ) as jt1
> > where js @> ('[ { "city": "Santiago de Cuba" } ]')
> > and js[0]->>'firstname' = 'Gilda'
> > ;
> > ERROR: function ExecEvalJson not in llvmjit_types.c
> >
> > That statement only errors out if the table is large enough. I have no time now to make a sample table but if no-one understands the problem off-hand, I'll try to construct such a table later this week (the one I'm using is large, 1.5 GB).
>
> Thank you for testing.
>
>
> I think you can try to add 3 missing functions references to the end of
> src/backend/jit/llvm/llvmjit_types.c:
>
>  void       *referenced_functions[] =
> {
>      ...
>      ExecEvalXmlExpr,
> +    ExecEvalJsonConstructor,
> +    ExecEvalIsJsonPredicate,
> +    ExecEvalJson,
>      MakeExpandedObjectReadOnlyInternal,
>      ...
> };
>
>
> If this fixes problem, I will add this to the new version of the patches.

It does almost fix it, but in the above is a typo:
+ ExecEvalIsJsonPredicate should to be changed to:
+ ExecEvalJsonIsPredicate.

With that change the problem vanishes.

Thanks!

Erik Rijkers

>
> --
> Nikita Glukhov
> Postgres Professional:http://www.postgrespro.co <http://www.postgrespro.com>The Russian Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-03-30 21:59:17 Re: Refactor SSL test framework to support multiple TLS libraries
Previous Message Isaac Morland 2021-03-30 21:42:30 Trouble with initdb trying to run regression tests