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 1nQedP-0007CX-8s for pljava-dev@arkaria.postgresql.org; Sun, 06 Mar 2022 00:20:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nQedM-00013D-BT for pljava-dev@arkaria.postgresql.org; Sun, 06 Mar 2022 00:20:24 +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 ) id 1nQedL-000134-OS for pljava-dev@lists.postgresql.org; Sun, 06 Mar 2022 00:20:24 +0000 Received: from mail-vs1-xe2f.google.com ([2607:f8b0:4864:20::e2f]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nQedH-0005TK-9Q for pljava-dev@lists.postgresql.org; Sun, 06 Mar 2022 00:20:22 +0000 Received: by mail-vs1-xe2f.google.com with SMTP id d11so12973633vsm.5 for ; Sat, 05 Mar 2022 16:20:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coyotesong.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oNkTtEeBt8UkQLO0CMQiPBAkjkyWVPH4Rq+plYAWMh8=; b=MG1HhQG982MkT4sdOQLrxAxHZ2ktrJohgQnknnPZEwu5+86/DempVixgyUHe8QIJBU vvTmOW3BJEE1ItNRJh+rJKpgnIiubRyurE9QNDD4CuKY5vW47o1DvRVgS+jSQdnien5B F2p2FS8KHhH3yoZebzgTzyylqX3TBktNpXJsA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oNkTtEeBt8UkQLO0CMQiPBAkjkyWVPH4Rq+plYAWMh8=; b=Jd66eKTZ02byielBq/d0X6oWU7Mz8UGdoWAY8YMdic4Qur8VMGGqLfIqR9uUdleGhB LMunEUKG144xshQ7IXZkfKLOQBEkGJuuj6GSddBG3tVKGwXeyItic6im15KQlRwE7prM wR5dosS/VSMbj+7naPlDs+tX7Ug+SHdwUmMbSGZXNu9h089cRvfXKpXi1Ki2v+Q6HgZ+ HEyh0kl3FzNEAVWnDzpxyPVU44VT9a94MbTJb//iS7oW9lE40P/dwsppo5+Iqkwn5IIS ni89NoY1MJTHPnPD31co49sRXngSb5xm5yVzps+u7NY5Yw2vK8WCruSXi3TWXZ7jjbSD IT2w== X-Gm-Message-State: AOAM5309dEWJYfOS05XkvtcDMm9fT23ufJDbRVNrhRsCj5aIX5gjpM5m eRodpaPoi/q8+floToPGnHCkDsGaSq1FuHe93ZwV2g== X-Google-Smtp-Source: ABdhPJxrthU4HwzsSoZb9A3T0djJ/ZzoawPFFqgHszFTT2SyNt9C45TvlusiD4MrVc/ygU5ifRAE0hengY8PgPBcj5k= X-Received: by 2002:a67:d611:0:b0:31b:b5d1:d37d with SMTP id n17-20020a67d611000000b0031bb5d1d37dmr1877306vsj.19.1646526018250; Sat, 05 Mar 2022 16:20:18 -0800 (PST) MIME-Version: 1.0 References: <6223DA89.80607@anastigmatix.net> In-Reply-To: From: Bear Giles Date: Sat, 5 Mar 2022 17:20:06 -0700 Message-ID: Subject: Re: Problem running examples.jar with official postgresql pljava deb To: Chapman Flack Cc: pljava-dev@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000006e7c7705d981b63d" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000006e7c7705d981b63d Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable All of the docker images are now running the query. I'm not removing the schema or samples jar though., - {1.6.4,"14.2 (Debian 14.2-1.pgdg110+1)",11.0.14,Linux,amd64} - {1.6.4,"13.6 (Debian 13.6-1.pgdg110+1)",11.0.14,Linux,amd64} - {1.6.4,"12.10 (Debian 12.10-1.pgdg110+1)",11.0.14,Linux,amd64} - {1.5.6,"11.15 (Debian 11.15-1.pgdg90+1)",1.8.0_322,Linux,amd64} - {1.5.6,"10.20 (Debian 10.20-1.pgdg90+1)",1.8.0_322,Linux,amd64} On Sat, Mar 5, 2022 at 4:16 PM Bear Giles wrote: > Thanks. I knew I had seen that* somewhere* but I couldn't find it again. > > The query works but I'm seeing something odd when I unwind the test. If I > execute > > postgres=3D# SELECT sqlj.set_classpath('javatest', ''); > postgres=3D# SELECT sqlj.remove_jar("ex", false); > > then reinstalling example.jar fails since the 'javatest' schema already > exists. However if I execute > > postgres=3D# DROP SCHEMA javatest CASCADE; > > then when I re-install examples.jar I get > > ERROR: type "javatest.complextuple" does not exist > > even though check_function_bodies has been set to off. > > Perhaps this isn't supported and I should just leave 'javatest' in place > since one of the goals is to make it easy to experiment with pl/java and > the location of the examples jar will be different on each docker image. > > BTW the values for the 'latest' image is > > {1.6.4,"14.2 (Debian 14.2-1.pgdg110+1)",11.0.14,Linux,amd64} > > I'll be creating docker images for PostgreSQL 10 through 14. > > > On Sat, Mar 5, 2022 at 2:47 PM Chapman Flack > wrote: > >> On 03/05/22 16:10, Bear Giles wrote: >> > INFO: 05 Mar 22 21:01:28 org.postgresql.pljava.example.LoggerTest >> > aggregate examples ok >> > INFO: 05 Mar 22 21:01:28 >> > org.postgresql.pljava.example.annotation.SPIActions issue 228 tests ok >> > ERROR: java.sql.SQLNonTransientException: resolving static method >> > org.postgresql.pljava.example.saxon.S9.like_regex with signature >> > (String,String,String,boolean)boolean: java.lang.ClassNotFoundExceptio= n: >> > net.sf.saxon.trans.XPathException >> >> I think you are running into the known complication that was introduced >> with 1.6.0, where functions are now validated at CREATE FUNCTION time, >> and can fail if a dependency isn't resolvable at that time. That's >> described here: >> >> >> http://tada.github.io/pljava/examples/examples.html#Exception_resolving_= class_or_method_.28message_when_installing_examples.29 >> >> with two different ways you can proceed: >> >> >> >> Install the required dependency first. Use sqlj.install_jar to insta= ll >> the Saxon jar (as described here), and sqlj.set_classpath to make it >> accessible, and then use sqlj.install_jar to install the examples jar >> itself. The dependency will be satisfied and all of the example function= s >> will work. >> >> Use SET check_function_bodies TO off before installing the examples >> jar. >> That will simply relax the strict checking at CREATE FUNCTION time, so >> that >> all of the example functions will be created. The ones that require Saxo= n, >> of course, won=E2=80=99t work; SET check_function_bodies TO off simply m= eans you >> get >> the errors later, when trying to use the functions, instead of when >> creating >> them. If you install the dependency jar later and add it to the class >> path, >> those functions will then work. >> >> >> The Saxon jar is pure library code; it doesn't declare any PL/Java >> functions. So no particular schema needs to exist before installing it. >> Of course, it needs to be added to a classpath before installing >> the examples jar (if using the dependency-first approach). I generally >> just add it to the public schema, which is the fallback for other schema >> class paths. >> >> SELECT sqlj.set_classpath('public', 'saxon'); >> >> Or, you might find it more convenient to use the >> SET check_function_bodies TO off; approach, install the examples jar >> first, >> then install the saxon jar, and finish by setting the schema classpath >> for javatest (which will exist by that point) to 'examples:saxon'. >> >> Regards, >> -Chap >> > --0000000000006e7c7705d981b63d Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
All of the docker=C2=A0images are now running the = query. I'm not removing the schema or samples jar though.,

  • {1.6.4= ,"14.2 (Debian 14.2-1.pgdg110+1)",11.0.14,Linux,amd64}
  • {1.6.4,"13.6 (Debian 13.= 6-1.pgdg110+1)",11.0.14,Linux,amd64}
  • {1.6.4,"12.10 (Debian 12.10-1.pgdg110+1)",= 11.0.14,Linux,amd64}
  • {1.5.6,"11.15 (Debian 11.15-1.pgdg90+1)",1.8.0_322,Linux,amd64}=
  • {1.5.6,"10.20= (Debian 10.20-1.pgdg90+1)",1.8.0_322,Linux,amd64}


On Sat, Mar 5, 2022 at 4:16 = PM Bear Giles <bgiles@coyoteson= g.com> wrote:
Thanks. I knew I had seen that=C2=A0som= ewhere but I couldn't find it again.

The query works but I'm seeing something odd when I unwind=C2=A0= the test. If I execute

=C2=A0 postgres=3D# SELECT sq= lj.set_classpath('javatest', '');
=C2=A0 postgres= =3D# SELECT sqlj.remove_jar("ex", false);

then reinstalling example.jar fails since the 'ja= vatest' schema already exists. However if I execute
=C2=A0 postgres=3D# DROP SCHEMA javatest=C2=A0CASCADE;

then when I re-install=C2=A0examples.jar I get
=

=C2=A0 ERROR: =C2=A0type "javatest.complextuple"= ; does not exist

even though check_function_bodies has been set to off.
=

Perhaps this isn't supported and I shou= ld just leave 'javatest' in place since one of the goals is to make= it easy to experiment=C2=A0with pl/java and the location of the examples j= ar will be different on each docker image.

BTW the values=C2=A0for the 'latest' image i= s

= =C2=A0{1.6.4,"14.2 (Debian = 14.2-1.pgdg110+1)",11.0.14,Linux,amd64}

I'll be creating = docker images for PostgreSQL 10 through 14.
=C2=A0

On = Sat, Mar 5, 2022 at 2:47 PM Chapman Flack <chap@anastigmatix.net> wrote:
On 03/05/22 16:10, Bear = Giles wrote:
> INFO:=C2=A0 05 Mar 22 21:01:28 org.postgresql.pljava.example.LoggerTes= t
> aggregate examples ok
> INFO:=C2=A0 05 Mar 22 21:01:28
> org.postgresql.pljava.example.annotation.SPIActions issue 228 tests ok=
> ERROR:=C2=A0 java.sql.SQLNonTransientException: resolving static metho= d
> org.postgresql.pljava.example.saxon.S9.like_regex with signature
> (String,String,String,boolean)boolean: java.lang.ClassNotFoundExceptio= n:
> net.sf.saxon.trans.XPathException

I think you are running into the known complication that was introduced
with 1.6.0, where functions are now validated at CREATE FUNCTION time,
and can fail if a dependency isn't resolvable at that time. That's<= br> described here:

http://tada.github.io/pljava/examples/examples.ht= ml#Exception_resolving_class_or_method_.28message_when_installing_examples.= 29

with two different ways you can proceed:



=C2=A0 =C2=A0 Install the required dependency first. Use sqlj.install_jar t= o install
the Saxon jar (as described here), and sqlj.set_classpath to make it
accessible, and then use sqlj.install_jar to install the examples jar
itself. The dependency will be satisfied and all of the example functions will work.

=C2=A0 =C2=A0 Use SET check_function_bodies TO off before installing the ex= amples jar.
That will simply relax the strict checking at CREATE FUNCTION time, so that=
all of the example functions will be created. The ones that require Saxon,<= br> of course, won=E2=80=99t work; SET check_function_bodies TO off simply mean= s you get
the errors later, when trying to use the functions, instead of when creatin= g
them. If you install the dependency jar later and add it to the class path,=
those functions will then work.


The Saxon jar is pure library code; it doesn't declare any PL/Java
functions. So no particular schema needs to exist before installing it.
Of course, it needs to be added to a classpath before installing
the examples jar (if using the dependency-first approach). I generally
just add it to the public schema, which is the fallback for other schema class paths.

SELECT sqlj.set_classpath('public', 'saxon');

Or, you might find it more convenient to use the
SET check_function_bodies TO off; approach, install the examples jar first,=
then install the saxon jar, and finish by setting the schema classpath
for javatest (which will exist by that point) to 'examples:saxon'.<= br>
Regards,
-Chap
--0000000000006e7c7705d981b63d--