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 1lrO3J-0002tr-MR for pgsql-general@arkaria.postgresql.org; Thu, 10 Jun 2021 17:01:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lrO3I-0008QW-Mv for pgsql-general@arkaria.postgresql.org; Thu, 10 Jun 2021 17:01:08 +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 1lrO3I-0008QO-EG for pgsql-general@lists.postgresql.org; Thu, 10 Jun 2021 17:01:08 +0000 Received: from mail.hjp.at ([212.17.106.138] helo=rorschach.hjp.at) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lrO3A-0004eL-Os for pgsql-general@lists.postgresql.org; Thu, 10 Jun 2021 17:01:08 +0000 Received: by rorschach.hjp.at (Postfix, from userid 1000) id 26C8A4DB7; Thu, 10 Jun 2021 19:00:59 +0200 (CEST) Date: Thu, 10 Jun 2021 19:00:59 +0200 From: "Peter J. Holzer" To: pgsql-general@lists.postgresql.org Subject: Re: How to pass a parameter in a query to postgreSQL 12 Message-ID: <20210610170059.GA18883@hjp.at> Mail-Followup-To: pgsql-general@lists.postgresql.org References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="gBBFr7Ir9EOA20Yy" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --gBBFr7Ir9EOA20Yy Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2021-06-09 14:51:46 -0500, Hassan Camacho Cadre wrote: > I recently installed a postgreSQL v12, in previous version 8.3 in all my > queries I pass parameters using the character : >=20 > SELECT >=20 > =A0 public.tabla.id >=20 > FROM=A0 >=20 > =A0 public.tabla >=20 > WHERE=A0=A0 >=20 > =A0 public.tabla.id =3D :a That looks Oracle-ish to me. > In the new version when I try to make this query it sends me an error >=20 > ERROR syntax error at or near ":" >=20 > =A0 >=20 > I tried >=20 > =A0 >=20 > ?a , =BFa, @a >=20 > =A0 >=20 > But I always got an error >=20 >=20 > I am executing this query on the query editor of pgadmin 4 I don't use pgAdmin4, and don't know how (and if) it handles parameters. Natively, PostgreSQL uses $1, $2, ... for parameters in prepared queries. AFAIK pgAdmin4 is written in Python, so it is likely that it supports the parameter binding of the Python PostgreSQL library in use (most likely psycopg2). That would be %s for unnamed parameters and %(name)s for named parameters. hp --=20 _ | Peter J. Holzer | Story must make more sense than reality. |_|_) | | | | | hjp@hjp.at | -- Charles Stross, "Creative writing __/ | http://www.hjp.at/ | challenge!" --gBBFr7Ir9EOA20Yy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETtJbRjyPwVTYGJ5k8g5IURL+KF0FAmDCRUYACgkQ8g5IURL+ KF36iQ/+INikuEP6qSYvO/Xt8oES8XmQlYry2FPsSWQwq2oJRb+n6BxjjHvpsgMv iQFoZcz4t5HyJkSGdvMuqqfkLoYL5b2+AgdQMusLx+0k9VpxXV1GrS/i7dWfv872 EOFHbXWMRU8pklXPJraVMGu4GAT3rBvAmQTFB8mpxq2JIp8HS1RNtasIpvaZs/Jt fYIuQef9fVPeVjlS9iIU1akb94GmfzjraF31s2o57r+WD212HdoltN6+JMjEj93Y zgGBEz9JqSP7Fs7e8BZ9xXipwAb/Kn9UNDC1Fu2w8JhcJYRjxHtpuncjoVRZqawi bdO0ZHlxUyAdSKjiqCHAi7g667Sz0iQqy4/hW7/2bC2sIa5vWdmPWPZYBvUoLGs4 sP5Py7tZETh17LmRz6/Zl6ggADx14Mgi8BR6xWL4BARxX/Xo+FggbpRs1mE879aU mHvAKvUdy5JgZuVUABABew5uDqsszBBgFooeFheiSlMzQDBMRbzeNadIyPIfBHhh H6k1/pKXnjfxphENoX5SjmKtk9/LTtQtBoC1GqVu7nGcVGif5wTHAI90kiDKAS+T A+ZWnC0vRBO6KXnC821jGYI8F7VpOUNadmcM1BnviAcafgkcumpSieV1YOZ5uyxt smw5wnvTb5b4xbEAMqJJp5/MsA5YfF3klURlZ3AVYRoHg4cH10Y= =IMja -----END PGP SIGNATURE----- --gBBFr7Ir9EOA20Yy--