Обсуждение: How to pass a parameter in a query to postgreSQL 11

Поиск
Список
Период
Сортировка

How to pass a parameter in a query to postgreSQL 11

От
Hassan Camacho Cadre
Дата:
Hello

I recently migrated from version 8.3 of postgreSQL to v11, previously in all my queries for passing parameters I used the character :

Example
Where id =: searched

In the new version when I try to make this query it sends me an error

ERROR syntax error at or near ":"

Could someone help me to know how I can configure the parameter passing character or, failing that, how I should pass the parameters in this new version.

Greetings

--
Atentamente Msc. Hassan Camacho.

Re: How to pass a parameter in a query to postgreSQL 11 (offtopic)

От
Justin Pryzby
Дата:
On Wed, Jun 09, 2021 at 05:30:15AM -0500, Hassan Camacho Cadre wrote:
> I recently migrated from version 8.3 of postgreSQL to v11, previously in
> all my queries for passing parameters I used the character :
> Example
> Where id =: searched

I guess you migrated to a whole new environment, with many new package
versions, not just postgres ?

We don't know how you're issuing queries, but I'm guessing some other
application is what changed.

Postgres uses $1 for query parameters, in both v8.3 and in v11.
https://www.postgresql.org/docs/8.3/libpq-exec.html

BTW, this is the list for development of postgres itself.  It's much too busy
to also answer other questions.  Please raise the question on the -general
list, with information about your environment.
https://www.postgresql.org/list/

Thanks,
-- 
Justin

> In the new version when I try to make this query it sends me an error
> 
> ERROR syntax error at or near ":"
> 
> Could someone help me to know how I can configure the parameter passing
> character or, failing that, how I should pass the parameters in this new
> version.