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 1pFyhd-0003qA-4w for pgsql-jdbc@arkaria.postgresql.org; Thu, 12 Jan 2023 14:37:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFyhb-0000j4-M1 for pgsql-jdbc@arkaria.postgresql.org; Thu, 12 Jan 2023 14:37:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pFyhb-0000iv-Em for pgsql-jdbc@lists.postgresql.org; Thu, 12 Jan 2023 14:37:11 +0000 Received: from pgintl.fastcrypt.com ([149.56.129.164]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pFyhU-0004tr-Oe for pgsql-jdbc@lists.postgresql.org; Thu, 12 Jan 2023 14:37:11 +0000 Received: from mail-vk1-f175.google.com (mail-vk1-f175.google.com [209.85.221.175]) by pgintl.fastcrypt.com (Postfix) with ESMTPSA id A40B6200C0 for ; Thu, 12 Jan 2023 09:37:01 -0500 (EST) Received: by mail-vk1-f175.google.com with SMTP id w72so8813458vkw.7 for ; Thu, 12 Jan 2023 06:37:01 -0800 (PST) X-Gm-Message-State: AFqh2kqEhLmSqYbXrGiXt2Yp7Z8DDPyHI5eCWsUTzIIuVqkVFyRAlame TpYwizrSr9mp+DLBMVLgD0jLXdEONHgoqv2zyXc= X-Google-Smtp-Source: AMrXdXsZjlrC8Xp/pMTj87IEWznv8mopnH1CXCw3kflvZBhv6Hh0vJ+9vWlSpN0ctCmAlO+G0NZey21RGmnkaDDN/gs= X-Received: by 2002:a1f:2d08:0:b0:3d8:d753:56bb with SMTP id t8-20020a1f2d08000000b003d8d75356bbmr4145697vkt.39.1673534220946; Thu, 12 Jan 2023 06:37:00 -0800 (PST) MIME-Version: 1.0 References: <784915.1673487222@sss.pgh.pa.us> <865715.1673493193@sss.pgh.pa.us> In-Reply-To: From: Dave Cramer Date: Thu, 12 Jan 2023 09:36:44 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: stringtype=unspecified is null check problem To: Martin Handsteiner Cc: Tom Lane , "David G. Johnston" , "pgsql-jdbc@lists.postgresql.org" Content-Type: multipart/alternative; boundary="000000000000c2545505f2120cd1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000c2545505f2120cd1 Content-Type: text/plain; charset="UTF-8" On Thu, 12 Jan 2023 at 03:32, Martin Handsteiner < martin.handsteiner@sibvisions.com> wrote: > Thanks a lot, I think, this will help a lot of (java) users, and makes the > usage of PostgreSQL DB a way better! > > I had yesterday an idea for a solution on java side. As we have already a > preprocessing with a jdbc wrapper, for function and procedure calls (in/out > parameters are not working with postgres jdbc), I'll added preprocessing > for the parameters. > > I'll search the statement for all question marks (?) that are not inside a > comment (-- \n, /* */), not in quotes (" ") and not in strings (' '), check > the parameter, if it is null, and replace the ? by null, and reduce the > parameter list. > > I can link the code if you want, as it is Apache License 2.0. > Please do --000000000000c2545505f2120cd1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Thu, 12 Jan 2023 at 03:32, Martin = Handsteiner <martin= .handsteiner@sibvisions.com> wrote:
Thanks a lot, I think, this will help a lot of (= java) users, and makes the usage of PostgreSQL DB a way better!

I had yesterday an idea for a solution on java side. As we have already a p= reprocessing with a jdbc wrapper, for function and procedure calls (in/out = parameters are not working with postgres jdbc), I'll added preprocessin= g for the parameters.

I'll search the statement for all question marks (?) that are not insid= e a comment (-- \n, /* */), not in quotes (" ") and not in string= s (' '), check the parameter, if it is null, and replace the ? by n= ull, and reduce the parameter list.

I can link the code if you want, as it is Apache License 2.0.
Please do
=C2=A0
--000000000000c2545505f2120cd1--