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 1mpU74-0005v3-KI for pgsql-general@arkaria.postgresql.org; Tue, 23 Nov 2021 11:37: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 1mpU72-0003rk-QN for pgsql-general@arkaria.postgresql.org; Tue, 23 Nov 2021 11:37:24 +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 1mpU72-0003py-Eb for pgsql-general@lists.postgresql.org; Tue, 23 Nov 2021 11:37:24 +0000 Received: from mail.tuxteam.de ([5.199.139.25]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mpU6w-0000bn-4z for pgsql-general@lists.postgresql.org; Tue, 23 Nov 2021 11:37:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=From:Content-Type:MIME-Version:Message-ID:Subject:To:Date:Sender: Reply-To:Cc:Content-Transfer-Encoding:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=iA3Vdwk/oJlq9YiHMl21A4RFg2JZ9+sZHFIP5QfYl7Y=; b=HvIoZ2Kho+Jiy4cmIA0zx99yKx Oxh0FVYcOC1uNu1NXd5NsoPSZ5M/6L6SHII5fvVqpocwSDdhIeEhFOWrlAeoiIdJNKrW35hfMi7WU /AA5dYKjmR2v3wD+u++luPKPLhwiJiPX9HBFgnAY2UkN453/C2hqxVveImWoMjpaAOTxretAIi7dD bFo11y544cgO9M954zK6CoFzQRb5lKJqk2ALmP3nqxYMnVwphJl8H2LjSN+2NtO/W69U+PTviYjOl /Fq18rZzdni6zh8bA7CVFVTBTotuiH382waDj4SGeV2XgmANhjGgwXVj3ohLMdvUUqWLQ9HMpvHqF oecorjTw==; Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1mpU6t-0000p9-I7 for pgsql-general@lists.postgresql.org; Tue, 23 Nov 2021 12:37:15 +0100 Date: Tue, 23 Nov 2021 12:37:15 +0100 To: pgsql-general Subject: PQexecParams, placeholders and variable lists of params Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="01HeuVBndUJITGzE" Content-Disposition: inline From: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --01HeuVBndUJITGzE Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, PQexecParams expects a query string with "$1", "$2"... placeholders, which refer to as many params in the param list. This keeps SQL injection at bay. Is there a way to express "variable length" lists? IOW, if I want to do a query like "SELECT * FROM customers WHERE id IN ($1, $2) AND name like $3;" is there a way to do that without knowing beforehand how many values go into the IN list? It would be very welcome for you to rub my nose against the place in The Fine Manual where I could have found that :-) Thanks & cheers - tom=C3=A1s --01HeuVBndUJITGzE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCYZzSZAAKCRAFyCz1etHa Rh1yAJ0QClDL4E3dNgSQK4dsAwV6ynISVQCeOGH9Uh55X2pKeyV1a2NbjNTXPxg= =5SOa -----END PGP SIGNATURE----- --01HeuVBndUJITGzE--