Re: Alias hstore's ? to ~ so that it works with JDBC

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: Seamus Abshere <seamus(at)abshere(dot)net>, Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Kris Jurka <books(at)ejurka(dot)com>, Dave Cramer <pg(at)fastcrypt(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>
Subject: Re: Alias hstore's ? to ~ so that it works with JDBC
Date: 2013-02-13 20:17:27
Message-ID: 1360786647.47998.YahooMailNeo@web162906.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Seamus Abshere <seamus(at)abshere(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message autarch 2013-02-13 20:22:43 BUG #7873: pg_restore --clean tries to drop tables that don't exist
Previous Message Heikki Linnakangas 2013-02-13 20:15:03 Re: 9.2.3 crashes during archive recovery