pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
To: Hassan Camacho Cadre <hccadre@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to pass a parameter in a query to postgreSQL 12
Date: Fri, 11 Jun 2021 10:52:40 +0200
Message-ID: <20210611105240.58659fd3@firost> (raw)
In-Reply-To: <CAK=f0z=mavji4zrUbUrZ-LxaH8hbbQosQ==biwA7LHTdjR-H4Q@mail.gmail.com>
References: <CAK=f0z=mavji4zrUbUrZ-LxaH8hbbQosQ==biwA7LHTdjR-H4Q@mail.gmail.com>

On Wed, 9 Jun 2021 14:51:46 -0500
Hassan Camacho Cadre <hccadre@gmail.com> wrote:

> Hello
> 
> 
> I recently installed a postgreSQL v12, in previous version 8.3 in all my
> queries I pass parameters using the character :
> 
> SELECT
> 
>   public.tabla.id
> 
> FROM
> 
>   public.tabla
> 
> WHERE
> 
>   public.tabla.id = :a
> 
> In the new version when I try to make this query it sends me an error
> 
> ERROR syntax error at or near ":"
> [...]
> I am executing this query on the query editor of pgadmin 4


The :varname syntaxe is only understood by psql, which parse it and replace
it with the value BEFORE sending the query to postgres. pgAdmin doesn't know
this syntaxe.

If you need to parameterize a query in pure SQL, use PREPARE/EXECUTE.

Regards,





view thread (3+ messages)

Message-ID: <20210611105240.58659fd3@firost>
Permalink:  ../20210611105240.58659fd3@firost/
Also on:    postgresql.org/message-id/20210611105240.58659fd3@firost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: jgdr@dalibo.com, hccadre@gmail.com
  Subject: Re: How to pass a parameter in a query to postgreSQL 12
  In-Reply-To: <20210611105240.58659fd3@firost>
  References: <CAK=f0z=mavji4zrUbUrZ-LxaH8hbbQosQ==biwA7LHTdjR-H4Q@mail.gmail.com> <20210611105240.58659fd3@firost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox