Re: placeholder syntax

From: "Thomas Hallgren" <thhal(at)mailblocks(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: placeholder syntax
Date: 2004-06-21 21:31:29
Message-ID: cb7k0e$9dt$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Personally, I agree. The '?' sucks for multiple reasons. The major reason
being when you want to use the same parameter in more than one place in a
statement. Another reason is query rewrites where you have to reorganize the
actual order of parameters. You are then forced to first convert the '?'
into some other form (like the $1, $2 syntax that PostgreSQL uses today).

But even if it sucks, it's used by a very broad range of clients. As Greg
mentions, both ODBC and JDBC uses this syntax and no other SQL database that
I know of treats '?' as an operator. The '?' is, and will remain, a
parameter placeholder in SQL for most people. So even if '?' shouldn't be
emulated at this time, perhaps it would be a good idea to abandon it as a
valid operator?

Kind regards,

Thomas Hallgren

"Greg Stark" <gsstark(at)mit(dot)edu> wrote in message
news:87brjcstpu(dot)fsf(at)stark(dot)xeocode(dot)com(dot)(dot)(dot)
>
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>
> > Abhijit Menon-Sen <ams(at)wiw(dot)org> writes:
> > > Should Postgres accept ? as a placeholder?
> >
> > In short, I think this notation sucks and I don't want to emulate it.
>
> Certainly it sucks. Unfortunately it's the supported ODBC API which is
> emulated by everyone else, including JDBC and DBI. So the world's pretty
much
> stuck with it.
>
> However this isn't Postgres's problem. If you want to write code that
works
> with multiple databases then you're going to want to be using something
like
> ODBC or JDBC or DBI anyways. In which case it's the driver's
responsibility to
> provide the standard API which includes translating ? into appropriate
syntax
> for the database.
>
> In other words, your problem should already be solved by your driver.
>
> --
> greg
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Cohen 2004-06-22 01:16:35 creating a cluster
Previous Message Mike Mascari 2004-06-21 18:06:35 Re: placeholder syntax