Re: How to write such a query?

From: Igor Korot <ikorot01(at)gmail(dot)com>
To: Amul Sul <sulamul(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to write such a query?
Date: 2022-01-06 07:14:31
Message-ID: CA+FnnTwJFdp20d7mFGjWHKP4NzLNMAqya7_zhMSJdUWuX=MOVw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, Armul,

On Thu, Jan 6, 2022 at 12:46 AM Amul Sul <sulamul(at)gmail(dot)com> wrote:
>
> See prepare statement : https://www.postgresql.org/docs/current/sql-prepare.html

The documentation is talking about a way to do it like:

SELECT a, b, c FROM foo WHERE id = $1,

which is equivalent to the

SELECT a, b, c FROM foo WHERE id = ?;

i.e. using unnamed parameter.

Thank you.

>
> On Thu, Jan 6, 2022 at 12:10 PM Igor Korot <ikorot01(at)gmail(dot)com> wrote:
> >
> > Hi, ALL,
> > In SQLite you can write:
> >
> > SELECT a, b, c FROM foo WHERE id = :id;
> >
> > where ":id" is the named parameter.
> >
> > The query above is similar to
> >
> > SELECT a,b,c FROM foo WHERE id = ?;
> >
> > except that the parameter has a name.
> >
> > Is there a way to write such a SELECT statement with the
> > named parameter in PostgreSQL?
> >
> > Thank you.
> >
> >

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron 2022-01-06 07:14:36 Re: How to write such a query?
Previous Message Ron 2022-01-06 07:11:26 Re: How to write such a query?