Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread Andrew Dunstan



David Fetter wrote:

On Mon, Sep 14, 2009 at 06:55:52PM -0400, Andrew Dunstan wrote:
  

David Fetter wrote:


On Mon, Sep 14, 2009 at 03:14:57PM -0700, Josh Berkus wrote:
  

Hackers,

I've just had a feature request from a client that we come up with
a way to enable JSON input into hstore.  This would make hstore
much more useful for software developers.

First question: would this go in the language driver, libpq, or
the backend?  Thoughts?


The backend, ideally in some pluggable way.  XML, under proper
circumstances, should work, as should YAML, etc.
  

The way the standard specifies SQL/XML requires grammar support.
That  means it can't really be pluggable. We've been over this
before.



I haven't found anything about hstore in the standard, so I'm not sure
how this applies.


  


You're the one that mentioned the backend being pluggable w.r.t. XML 
among other things.


In any case, this is academic. It has become clear in off-list 
discussion that support for JSON input isn't really what the requestor 
needs. What he needs is a way to translate a Perl hashref to an hstore 
literal and vice versa, and Andrew Gierth has written some nice routines 
in Perl to do just that.


cheers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread Robert Haas
On Mon, Sep 14, 2009 at 7:42 PM, David E. Wheeler  wrote:
> On Sep 14, 2009, at 4:32 PM, Robert Haas wrote:
>
>>> What's wrong with just using a variant of the type input function? With
>>> a parameterized insert, it doesn't seem like it's really placing much of
>>> a burden on the application.
>>
>> Agreed, I was thinking the same thing.
>
> And the type output function, too. Not sure how you'd configure that,
> though.

Well I don't think you really need any them to BE the type
input/output functions.  You just need

hstore_to_json(hstore) returns text
json_to_hstore(text) returns json

Insert into your query where appropriate.

...Robert

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread David E. Wheeler

On Sep 14, 2009, at 4:32 PM, Robert Haas wrote:

What's wrong with just using a variant of the type input function?  
With
a parameterized insert, it doesn't seem like it's really placing  
much of

a burden on the application.


Agreed, I was thinking the same thing.


And the type output function, too. Not sure how you'd configure that,  
though.


David

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread Robert Haas

On Sep 14, 2009, at 7:05 PM, Jeff Davis  wrote:


On Mon, 2009-09-14 at 15:14 -0700, Josh Berkus wrote:

Hackers,

I've just had a feature request from a client that we come up with  
a way

to enable JSON input into hstore.  This would make hstore much more
useful for software developers.

First question: would this go in the language driver, libpq, or the
backend?  Thoughts?


What's wrong with just using a variant of the type input function?  
With
a parameterized insert, it doesn't seem like it's really placing  
much of

a burden on the application.


Agreed, I was thinking the same thing.

...Roberta

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread David Fetter
On Mon, Sep 14, 2009 at 06:55:52PM -0400, Andrew Dunstan wrote:
> David Fetter wrote:
>> On Mon, Sep 14, 2009 at 03:14:57PM -0700, Josh Berkus wrote:
>>> Hackers,
>>>
>>> I've just had a feature request from a client that we come up with
>>> a way to enable JSON input into hstore.  This would make hstore
>>> much more useful for software developers.
>>>
>>> First question: would this go in the language driver, libpq, or
>>> the backend?  Thoughts?
>>
>> The backend, ideally in some pluggable way.  XML, under proper
>> circumstances, should work, as should YAML, etc.
>
> The way the standard specifies SQL/XML requires grammar support.
> That  means it can't really be pluggable. We've been over this
> before.

I haven't found anything about hstore in the standard, so I'm not sure
how this applies.

Cheers,
David.
-- 
David Fetter  http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: david.fet...@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread Jeff Davis
On Mon, 2009-09-14 at 15:14 -0700, Josh Berkus wrote:
> Hackers,
> 
> I've just had a feature request from a client that we come up with a way
> to enable JSON input into hstore.  This would make hstore much more
> useful for software developers.
> 
> First question: would this go in the language driver, libpq, or the
> backend?  Thoughts?

What's wrong with just using a variant of the type input function? With
a parameterized insert, it doesn't seem like it's really placing much of
a burden on the application.

Or am I missing the use case?

Regards,
Jeff Davis


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread Tom Lane
David Fetter  writes:
> On Mon, Sep 14, 2009 at 03:14:57PM -0700, Josh Berkus wrote:
>> I've just had a feature request from a client that we come up with a
>> way to enable JSON input into hstore.  This would make hstore much
>> more useful for software developers.
>> 
>> First question: would this go in the language driver, libpq, or the
>> backend?  Thoughts?

> The backend, ideally in some pluggable way.  XML, under proper
> circumstances, should work, as should YAML, etc.

Uh, hstore is a contrib module.  Why aren't we talking about just some
more code in the contrib module?  Adding anything to support a contrib
module in, say, libpq seems right out.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread Andrew Dunstan



David Fetter wrote:

On Mon, Sep 14, 2009 at 03:14:57PM -0700, Josh Berkus wrote:
  

Hackers,

I've just had a feature request from a client that we come up with a
way to enable JSON input into hstore.  This would make hstore much
more useful for software developers.

First question: would this go in the language driver, libpq, or the
backend?  Thoughts?



The backend, ideally in some pluggable way.  XML, under proper
circumstances, should work, as should YAML, etc.


  


The way the standard specifies SQL/XML requires grammar support. That 
means it can't really be pluggable. We've been over this before.


chjeers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Feature Request: JSON input for hstore

2009-09-14 Thread David Fetter
On Mon, Sep 14, 2009 at 03:14:57PM -0700, Josh Berkus wrote:
> Hackers,
> 
> I've just had a feature request from a client that we come up with a
> way to enable JSON input into hstore.  This would make hstore much
> more useful for software developers.
> 
> First question: would this go in the language driver, libpq, or the
> backend?  Thoughts?

The backend, ideally in some pluggable way.  XML, under proper
circumstances, should work, as should YAML, etc.

Cheers,
David.
-- 
David Fetter  http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter  XMPP: david.fet...@gmail.com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers