From: | Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com> |
---|---|
To: | Hassan Camacho Cadre <hccadre(at)gmail(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: How to pass a parameter in a query to postgreSQL 12 |
Date: | 2021-06-11 08:52:40 |
Message-ID: | 20210611105240.58659fd3@firost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 9 Jun 2021 14:51:46 -0500
Hassan Camacho Cadre <hccadre(at)gmail(dot)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,
From | Date | Subject | |
---|---|---|---|
Next Message | Marc Millas | 2021-06-11 12:37:57 | Re: index unique |
Previous Message | Willy-Bas Loos | 2021-06-11 07:51:59 | Re: WAL accumulating, Logical Replication pg 13 |