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 1mpWfR-00050v-8k for pgsql-general@arkaria.postgresql.org; Tue, 23 Nov 2021 14:21:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mpWfP-00053l-F6 for pgsql-general@arkaria.postgresql.org; Tue, 23 Nov 2021 14:21:03 +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 1mpWfP-00053c-4H for pgsql-general@lists.postgresql.org; Tue, 23 Nov 2021 14:21:03 +0000 Received: from mail.tuxteam.de ([5.199.139.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpWfM-0003xQ-AW for pgsql-general@lists.postgresql.org; Tue, 23 Nov 2021 14:21:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject :Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Wcjp778lKZP+a1JAoXu/apkgKowp4CnMnn2eh1ixWTs=; b=tVqhbsfW+p8xfK7BmOoklikNYs IJ/M/7XYREJhta5h01P7BHkaCvhD13mUdQ6mABpJRELHIuuOqTPBoXAkCp1qGhTn3pZZlyyvnNKlV K27NlrxENYdqyvQeHUd6A5Dt/MEUF0OyyYXHwgBKtsHPT+fWEzpkUIAHAXSr78C/Gw5rAamN39CeG 0QEy29gXABA3M1oZ+O1ln7nYeXLwq6eNW28VJtW6TNllDHe+SRgbLy/xApjUi6wSrrO4GlDZAHajC VL67FM2H2Mjf1wBkKSdIPytoJRUumWotrkHPxmqNCJuO9ajvZ7tSuVvgw38VV3XeX4OxY5jCNH8QZ 18XrHIoQ==; Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1mpWfJ-00017G-M5; Tue, 23 Nov 2021 15:20:57 +0100 Date: Tue, 23 Nov 2021 15:20:57 +0100 From: tomas@tuxteam.de To: =?utf-8?B?0JTQvNC40YLRgNC40Lkg0JjQstCw0L3QvtCy?= Cc: pgsql-general Subject: Re: PQexecParams, placeholders and variable lists of params Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JRKpwKHgyNnyS7to" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --JRKpwKHgyNnyS7to Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 23, 2021 at 06:39:27PM +0500, =D0=94=D0=BC=D0=B8=D1=82=D1=80=D0= =B8=D0=B9 =D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2 wrote: > Hi > A function cannot have an undefined signature, but can accept an array of > arguments: I see. So you propose passing an array as a single param to PQexecParams, in PostgreSQL's syntax for arrays, e.g.. "{42, 45, 50}". Makes sense. Problem is, that, again, the application would be responsible of making sure the individual values don't contain nasty stuff (for example, if they are strings) before consolidating them to one PostgreSQL array literal. I was hoping to get away "on the cheap" on this, letting PostgreSQL take care of the injection avoidance ;-) I'm converging in building the query dynamically, but still with placeholders. I /know/ how many values are coming, and how many placeholders used so-far in the query, so it'd be fairly easy to just insert "$m"..."$n" as needed. Thanks a lot, Dmitri Cheers - t --JRKpwKHgyNnyS7to Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCYZz4wwAKCRAFyCz1etHa RhRCAJ42bUI1TGgranRJR+waxPAR2K3tOwCeIPjJY2OvuS8O91eVBdFYggthvuY= =aiS7 -----END PGP SIGNATURE----- --JRKpwKHgyNnyS7to--