Re: Alias hstore's ? to ~ so that it works with JDBC
От | Heikki Linnakangas |
---|---|
Тема | Re: Alias hstore's ? to ~ so that it works with JDBC |
Дата | |
Msg-id | 511BF910.5070507@vmware.com обсуждение исходный текст |
Ответ на | Re: Alias hstore's ? to ~ so that it works with JDBC (Kevin Grittner <kgrittn@ymail.com>) |
Ответы |
Re: Alias hstore's ? to ~ so that it works with JDBC
|
Список | pgsql-hackers |
On 13.02.2013 22:17, Kevin Grittner wrote: > Seamus Abshere<seamus@abshere.net> wrote: >> SELECT * FROM tbl WHERE data {postgres qm} 'abc' > > That suggestion makes a lot of sense to me. The curly-brace > escapes are in JDBC for portability, so this seems like a totally > appropriate use; it's surprising it hasn't come up before. +1 for something like this. Rather than a straight "{postgres qm}" to represent a question mark, though, perhaps it would be more readable to allow something like this though: {postgres SELECT * FROM tbl WHERE data ? 'abc' AND column = $1} Ie. within "{postgres ... }", ? means a question mark, not a parameter marker, and for parameter markers, you use the PostgreSQL syntax, $n. Also, should we consider how to escape { and } characters? They're not a problem at the moment, but while we're at it... >> I guess I see 2 simple options and 1 complex option: >> >> a) [simple] operator("+") per Heikki >> b) [simple, but not popular] alias ? to ~ per Seamus >> c) [complex] {postgres blah} per Lance/Mark >> >> How to decide? > > We already have code in the JDBC driver to recognize curly-brace > escape sequences. We just need to add "postgres" as another > keyword for such escapes and we can do what we like for the rest of > the escape sequence. A mnemonic, such as Lance suggests, does seem > like a good approach. We could support operator("?") as well; belt and suspenders. That would help ODBC clients too. - Heikki
В списке pgsql-hackers по дате отправления: