Re: Alias hstore's ? to ~ so that it works with JDBC - Mailing list pgsql-hackers

From Kevin Grittner
Subject Re: Alias hstore's ? to ~ so that it works with JDBC
Date
Msg-id 1360786647.47998.YahooMailNeo@web162906.mail.bf1.yahoo.com
Whole thread Raw
In response to Re: Alias hstore's ? to ~ so that it works with JDBC  (Seamus Abshere <seamus@abshere.net>)
Responses Re: Alias hstore's ? to ~ so that it works with JDBC  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
Seamus Abshere <seamus@abshere.net> wrote:
> On 2/11/13 1:35 PM, Heikki Linnakangas wrote:
>> I agree it's pretty dumb that there's currently no such escape.
>> I think JDBC inherited that design mistake from ODBC. Fixing
>> that would be a good idea.
>
> Lance Anderson, Oracle's JDBC spec lead

Wow, there's a name I haven't seen in years.  I used to deal with
him often when he was at Sybase, and once or twice after he moved
to Sun.  Sharp guy.

> says we can implement something like:
>
>     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.

> 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.

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: proposal or just idea for psql - show first N rows from relation backslash statement
Next
From: Stephen Frost
Date:
Subject: Re: proposal or just idea for psql - show first N rows from relation backslash statement