From: Robert Haas on 18 Dec 2009 11:51 On Fri, Dec 18, 2009 at 11:32 AM, David E. Wheeler <david(a)kineticode.com> wrote: > On Dec 18, 2009, at 4:49 AM, Peter Eisentraut wrote: > >> Should we create a json type before adding all kinds of json formatted >> data? Or are we content with json as text? > > json_data_type++ What would that do for us? I'm not opposed to it, but it seems like the more important thing would be to provide functions or operators that can do things like extract an array, extract a hash key, identify whether something is a hash, list, or scalar, etc. ....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
From: "David E. Wheeler" on 18 Dec 2009 11:56 On Dec 18, 2009, at 8:51 AM, Robert Haas wrote: > What would that do for us? > > I'm not opposed to it, but it seems like the more important thing > would be to provide functions or operators that can do things like > extract an array, extract a hash key, identify whether something is a > hash, list, or scalar, etc. Such things would be included with such a data type, no? Best, David -- 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: Andrew Dunstan on 18 Dec 2009 13:56 Robert Haas wrote: > On Fri, Dec 18, 2009 at 11:32 AM, David E. Wheeler <david(a)kineticode.com> wrote: > >> On Dec 18, 2009, at 4:49 AM, Peter Eisentraut wrote: >> >> >>> Should we create a json type before adding all kinds of json formatted >>> data? Or are we content with json as text? >>> >> json_data_type++ >> > > What would that do for us? > > I'm not opposed to it, but it seems like the more important thing > would be to provide functions or operators that can do things like > extract an array, extract a hash key, identify whether something is a > hash, list, or scalar, etc. > > > In principle it's not a bad idea to have a JSON type for several reasons. First, it's a better match than hstore for serializing an arbitrary tuple, because unlike hstore it can have nested arrays and composites, just as tuples can. Second, it might well be very useful if we could easily return results as JSON to AJAX applications, which are increasingly becoming the norm. And similarly we might be able to reduce application load if Postgres could perform operations on JSON, rather than having to return it all to the client to process. I think it would be useful if someone produced a JSON module as, say, a pgFoundry project, to start with, and we would then be better able to assess its usefulness. An interesting question would be how one might sanely index such things. 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. If the operations can be sure that the object is valid JSON they could skip a bunch of sanity checks that they would otherwise need to do if just handed an arbitrary piece of text. cheers andrew -- 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 18 Dec 2009 14:25 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 :-( ] 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: Andrew Dunstan on 18 Dec 2009 14:37
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. cheers andrew -- Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers |