Re: Will there be a JSON operator like ->> but returning numeric?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Seamus Abshere <seamus(at)abshere(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Will there be a JSON operator like ->> but returning numeric?
Date: 2014-09-23 16:54:38
Message-ID: 14669.1411491278@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Seamus Abshere <seamus(at)abshere(dot)net> writes:
> I've got use cases like
>> array_remove(array_agg((a->>'b')::float), NULL)
> It would be nice to replace (a->>'b')::float with something like
>> a->^'b'
> that directly returned a numeric... is that in the cards?

I believe we discussed this, along with variants to return boolean
etc, and concluded that it was not really worth doing. For one
thing, it's hard to see how to pick reasonably mnemonic operator
names. The cast syntax may be a bit more verbose but at least
it's pretty self-documenting.

Of course, you're free to create custom operators or functions
for your own use ...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Paul Ramsey 2014-09-23 16:55:32 fmgr_oldstyle in extensions
Previous Message Tom Lane 2014-09-23 16:41:24 Re: Unexpected syntax error when using JSON -> in 9.3.5