From: Bruce Momjian on
Andrew Dunstan wrote:
>
>
> Tom Lane wrote:
> > Andrew Dunstan <andrew(a)dunslane.net> writes:
> >
> >> You're correct that we don't necessarily need a new type, we could just
> >> make it text and have a bunch of operations, but that seems to violate
> >> the principle of data type abstraction a bit.
> >>
> >
> > I think the relevant precedent is that we have an xml type. While I
> > surely don't want to follow the SQL committee's precedent of inventing
> > a ton of special syntax for xml support, it might be useful to look at
> > that for suggestions of what functionality would be useful for a json
> > type.
> >
> > [ I can already hear somebody insisting on a yaml type :-( ]
> >
> >
> >
>
> Now that's a case where I think a couple of converter functions at most
> should meet the need.

I can see this feature getting web developers more excited about
Postgres.

--
Bruce Momjian <bruce(a)momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

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

From: Tom Lane on
Andrew Dunstan <andrew(a)dunslane.net> writes:
> Tom Lane wrote:
>> [ I can already hear somebody insisting on a yaml type :-( ]

> Now that's a case where I think a couple of converter functions at most
> should meet the need.

Well, actually, now that you mention it: how much of a json type would
be duplicative of the xml stuff? Would it be sufficient to provide
json <-> xml converters and let the latter type do all the heavy lifting?
(If so, this patch ought to be hstore_to_xml instead.)

regards, tom lane

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

From: Alvaro Herrera on
Tom Lane escribi�:
> Andrew Dunstan <andrew(a)dunslane.net> writes:
> > Tom Lane wrote:
> >> [ I can already hear somebody insisting on a yaml type :-( ]
>
> > Now that's a case where I think a couple of converter functions at most
> > should meet the need.
>
> Well, actually, now that you mention it: how much of a json type would
> be duplicative of the xml stuff? Would it be sufficient to provide
> json <-> xml converters and let the latter type do all the heavy lifting?
> (If so, this patch ought to be hstore_to_xml instead.)

But then there's the matter of overhead: how much would be wasted by
transforming to XML, and then parsing the XML back to transform to JSON?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

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

From: Tom Lane on
Alvaro Herrera <alvherre(a)commandprompt.com> writes:
> Tom Lane escribi�:
>> Well, actually, now that you mention it: how much of a json type would
>> be duplicative of the xml stuff? Would it be sufficient to provide
>> json <-> xml converters and let the latter type do all the heavy lifting?
>> (If so, this patch ought to be hstore_to_xml instead.)

> But then there's the matter of overhead: how much would be wasted by
> transforming to XML, and then parsing the XML back to transform to JSON?

Well, that would presumably happen only when sending data to or from the
client. It's not obvious that it would be much more expensive than the
syntax checking you'd have to do anyway.

If there's some reason to think that operating on json data would be
much less expensive than operating on xml, there might be a case for
having two distinct sets of operations internally, but I haven't heard
anybody make that argument.

regards, tom lane

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

From: Robert Haas on
On Fri, Dec 18, 2009 at 3:00 PM, Tom Lane <tgl(a)sss.pgh.pa.us> wrote:
> Alvaro Herrera <alvherre(a)commandprompt.com> writes:
>> Tom Lane escribió:
>>> Well, actually, now that you mention it: how much of a json type would
>>> be duplicative of the xml stuff?  Would it be sufficient to provide
>>> json <-> xml converters and let the latter type do all the heavy lifting?
>>> (If so, this patch ought to be hstore_to_xml instead.)
>
>> But then there's the matter of overhead: how much would be wasted by
>> transforming to XML, and then parsing the XML back to transform to JSON?
>
> Well, that would presumably happen only when sending data to or from the
> client.  It's not obvious that it would be much more expensive than the
> syntax checking you'd have to do anyway.
>
> If there's some reason to think that operating on json data would be
> much less expensive than operating on xml, there might be a case for
> having two distinct sets of operations internally, but I haven't heard
> anybody make that argument.

One problem is that there is not a single well-defined mapping between
these types. I would say generally that XML and YAML both have more
types of constructs than JSON. The obvious ways of translating an
arbitrary XML document to JSON are likely not to be what people want
in particular cases.

I think the performance argument is compelling, too, but we can't even
try benchmarking it unless we can define what we're even talking
about.

....Robert

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