Re: [HACKERS] jsonb problematic operators

2016-12-16 Thread Tom Lane
Geoff Winkless writes: > To look at this from the other angle, is there a reason why the jsonb > indexes don't work with the jsonb_ functions but only with the > operators? Is this something that could be changed easily? Yes. No. However, if you're desperate, you could

Re: [HACKERS] jsonb problematic operators

2016-12-16 Thread Geoff Winkless
On 16 December 2016 at 09:35, Craig Ringer wrote: > so it would be consistent with that to use ?? as a literal ? in the > output query. > > This is also what PgJDBC does, per > https://jdbc.postgresql.org/documentation/head/statement.html . So > it's consistent . "Me too".

Re: [HACKERS] jsonb problematic operators

2016-12-16 Thread Craig Ringer
On 16 December 2016 at 17:08, Matteo Beccati wrote: > Hi, > > On 12/12/2016 05:09, Craig Ringer wrote: >> Does PDO let you double question marks to escape them, writing ?? or >> \? instead of ? or anything like that? >> >> If not, I suggest that you (a) submit a postgres patch

Re: [HACKERS] jsonb problematic operators

2016-12-16 Thread Matteo Beccati
Hi, On 12/12/2016 05:09, Craig Ringer wrote: > Does PDO let you double question marks to escape them, writing ?? or > \? instead of ? or anything like that? > > If not, I suggest that you (a) submit a postgres patch adding > alternative operator names for ? and ?|, and (b) submit a PDO patch to

Re: [HACKERS] jsonb problematic operators

2016-12-13 Thread Tom Lane
Nico Williams writes: > On Tue, Dec 13, 2016 at 10:26:24AM +0900, Michael Paquier wrote: >> On Mon, Dec 12, 2016 at 10:22 PM, Greg Stark wrote: >>> One option might be for Postgres to define duplicate operator names >>> using ¿ or something else. >> Are you

Re: [HACKERS] jsonb problematic operators

2016-12-13 Thread Nico Williams
On Tue, Dec 13, 2016 at 10:26:24AM +0900, Michael Paquier wrote: > On Mon, Dec 12, 2016 at 10:22 PM, Greg Stark wrote: > > One option might be for Postgres to define duplicate operator names > > using ¿ or something else. I think ¿ is a good choice because it's a > > common

Re: [HACKERS] jsonb problematic operators

2016-12-13 Thread Robert Haas
On Mon, Dec 12, 2016 at 8:26 PM, Michael Paquier wrote: > On Mon, Dec 12, 2016 at 10:22 PM, Greg Stark wrote: >> On 12 December 2016 at 04:59, Craig Ringer wrote: >>> I didn't realise Pg's use of ? was that old, so thanks. That

Re: [HACKERS] jsonb problematic operators

2016-12-12 Thread Michael Paquier
On Mon, Dec 12, 2016 at 10:22 PM, Greg Stark wrote: > On 12 December 2016 at 04:59, Craig Ringer wrote: >> I didn't realise Pg's use of ? was that old, so thanks. That makes >> offering alternatives much less appealing. > > One option might be for Postgres

Re: [HACKERS] jsonb problematic operators

2016-12-12 Thread Craig Ringer
On 12 Dec. 2016 22:22, "Merlin Moncure" wrote: If we really wanted to fix this, maybe the right way to think about the problem is a highly reduced character set and a pre-processor or an extension. I'm pretty OK with expecting client drivers not to be stupid and offer

Re: [HACKERS] jsonb problematic operators

2016-12-12 Thread Merlin Moncure
On Sun, Dec 11, 2016 at 10:59 PM, Craig Ringer wrote: > PgJDBC allows you to write ??, which is ugly, but tolerable, since the > JDBC spec doesn't have an escape syntax for it. This is the core problem; *JDBC* is busted. SQL reserves words but not punctuation marks so any

Re: [HACKERS] jsonb problematic operators

2016-12-12 Thread Greg Stark
On 12 December 2016 at 04:59, Craig Ringer wrote: > I didn't realise Pg's use of ? was that old, so thanks. That makes > offering alternatives much less appealing. One option might be for Postgres to define duplicate operator names using ¿ or something else. I think ¿ is a

Re: [HACKERS] jsonb problematic operators

2016-12-11 Thread Craig Ringer
On 12 December 2016 at 12:52, Tom Lane wrote: > Craig Ringer writes: >> It's definitely annoying, in both directions. ? wasn't a great choice >> for an operator character but it's logical and was grandfathered over >> from hstore. > > It was

Re: [HACKERS] jsonb problematic operators

2016-12-11 Thread Tom Lane
Craig Ringer writes: > It's definitely annoying, in both directions. ? wasn't a great choice > for an operator character but it's logical and was grandfathered over > from hstore. It was grandfathered from a lot further back than that. A quick look into the system

Re: [HACKERS] jsonb problematic operators

2016-12-11 Thread Craig Ringer
On 11 December 2016 at 18:52, Geoff Winkless wrote: > On 9 Dec 2016 17:54, "Andres Freund" wrote: > > On 2016-12-09 12:17:32 -0500, Robert Haas wrote: >> As Geoff says, you don't have to use the operators; you could use the >> equivalent functions

Re: [HACKERS] jsonb problematic operators

2016-12-11 Thread Geoff Winkless
On 9 Dec 2016 17:54, "Andres Freund" wrote: On 2016-12-09 12:17:32 -0500, Robert Haas wrote: > As Geoff says, you don't have to use the operators; you could use the > equivalent functions instead. Every operator just gets turned into a > function call internally, so this is

Re: [HACKERS] jsonb problematic operators

2016-12-09 Thread Andres Freund
On 2016-12-09 12:17:32 -0500, Robert Haas wrote: > As Geoff says, you don't have to use the operators; you could use the > equivalent functions instead. Every operator just gets turned into a > function call internally, so this is always possible. Well, except that only operators support

Re: [HACKERS] jsonb problematic operators

2016-12-09 Thread David G. Johnston
On Fri, Dec 9, 2016 at 10:17 AM, Robert Haas wrote: > > As Geoff says, you don't have to use the operators; you could use the > equivalent functions instead. Every operator just gets turned into a > function call internally, so this is always possible. > In most cases -

Re: [HACKERS] jsonb problematic operators

2016-12-09 Thread Merlin Moncure
On Fri, Dec 9, 2016 at 5:50 AM, Jordan Gigov wrote: > There is this problem with the jsonb operators "? text" "?| text[]" > and "?& text[]" that the question mark is typically used for prepared > statement parameters in the most used abstraction APIs in Java and > PHP. > >

Re: [HACKERS] jsonb problematic operators

2016-12-09 Thread Robert Haas
On Fri, Dec 9, 2016 at 6:50 AM, Jordan Gigov wrote: > It's not a good idea to expect everyone else to make for workarounds > for problems you choose to create. True. I actually kinda agree that the use of ? wasn't a great choice here, precisely because a number of drivers do

Re: [HACKERS] jsonb problematic operators

2016-12-09 Thread David G. Johnston
On Fri, Dec 9, 2016 at 4:50 AM, Jordan Gigov wrote: > There is this problem with the jsonb operators "? text" "?| text[]" > and "?& text[]" that the question mark is typically used for prepared > statement parameters in the most used abstraction APIs in Java and > PHP. >

Re: [HACKERS] jsonb problematic operators

2016-12-09 Thread Geoff Winkless
On 9 December 2016 at 11:50, Jordan Gigov wrote: > There is this problem with the jsonb operators "? text" "?| text[]" > and "?& text[]" that the question mark is typically used for prepared > statement parameters in the most used abstraction APIs in Java and > PHP. > > This

[HACKERS] jsonb problematic operators

2016-12-09 Thread Jordan Gigov
There is this problem with the jsonb operators "? text" "?| text[]" and "?& text[]" that the question mark is typically used for prepared statement parameters in the most used abstraction APIs in Java and PHP. This really needs an alternative. Something like "HAS text", "HAS ANY(text[])" and "HAS