Re: placeholder syntax
От | Thomas Hallgren |
---|---|
Тема | Re: placeholder syntax |
Дата | |
Msg-id | cb7k0e$9dt$1@news.hub.org обсуждение исходный текст |
Ответ на | placeholder syntax (Abhijit Menon-Sen <ams@wiw.org>) |
Список | 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@mit.edu> wrote in message news:87brjcstpu.fsf@stark.xeocode.com... > > Tom Lane <tgl@sss.pgh.pa.us> writes: > > > Abhijit Menon-Sen <ams@wiw.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@postgresql.org) >
В списке pgsql-hackers по дате отправления: