Re: [HACKERS] JSON manipulation functions

2010-05-27 Thread Tom Lane
Robert Haas writes: > On Thu, May 27, 2010 at 3:50 PM, Tom Lane wrote: >> It certainly is --- he was actually declaring a cast with it in his >> example, no? > That was an attempt at a workaround to get it to do what he wanted. Oh. If you don't want to think of it as being a cast-like operatio

Re: [HACKERS] JSON manipulation functions

2010-05-27 Thread Robert Haas
On Thu, May 27, 2010 at 3:50 PM, Tom Lane wrote: > Robert Haas writes: >> On Thu, May 27, 2010 at 3:35 PM, Tom Lane wrote: >>> If the function is a cast function (which it is), > >> I don't think it is. > > It certainly is --- he was actually declaring a cast with it in his > example, no? That

Re: [HACKERS] JSON manipulation functions

2010-05-27 Thread Tom Lane
Robert Haas writes: > On Thu, May 27, 2010 at 3:35 PM, Tom Lane wrote: >> If the function is a cast function (which it is), > I don't think it is. It certainly is --- he was actually declaring a cast with it in his example, no? regards, tom lane -- Sent via pgsql-hack

Re: [HACKERS] JSON manipulation functions

2010-05-27 Thread Robert Haas
On Thu, May 27, 2010 at 3:35 PM, Tom Lane wrote: > If the function is a cast function (which it is), I don't think it is. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise Postgres Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make chan

Re: [HACKERS] JSON manipulation functions

2010-05-27 Thread Tom Lane
Joseph Adams writes: > I tried making a function named json_type that has the same name as > the type json_type. However, this doesn't work as expected: > SELECT json_type('[1,2,3]'); > Instead of calling json_type with '[1,2,3]' casted to JSON, it's > trying to cast '[1,2,3]' to json_type. Is

Re: [HACKERS] JSON manipulation functions

2010-05-27 Thread Robert Haas
On Thu, May 27, 2010 at 2:39 PM, Joseph Adams wrote: > I've started implementing the JSON datatype; the repo is at > http://git.postgresql.org/gitweb?p=json-datatype.git . > > On Fri, May 14, 2010 at 1:15 PM, Robert Haas wrote: >> On Thu, May 13, 2010 at 9:47 PM, Joseph Adams >> wrote: >>> Would

Re: [HACKERS] JSON manipulation functions

2010-05-27 Thread Joseph Adams
I've started implementing the JSON datatype; the repo is at http://git.postgresql.org/gitweb?p=json-datatype.git . On Fri, May 14, 2010 at 1:15 PM, Robert Haas wrote: > On Thu, May 13, 2010 at 9:47 PM, Joseph Adams > wrote: >> Would it be a bad idea to give an enum and a function the same name >

Re: [HACKERS] JSON manipulation functions

2010-05-25 Thread Robert Haas
On Tue, May 25, 2010 at 10:52 AM, Joseph Adams wrote: >> Well, I think it's fine to use the wiki for brainstorming, but before >> you change the design you probably need to talk about it here.  You >> can't rely on everyone on -hackers to follow changes on a wiki page >> somewhere.  It looks like

Re: [HACKERS] JSON manipulation functions

2010-05-25 Thread Joseph Adams
> Well, I think it's fine to use the wiki for brainstorming, but before > you change the design you probably need to talk about it here.  You > can't rely on everyone on -hackers to follow changes on a wiki page > somewhere.  It looks like the API has been overhauled pretty heavily > since the last

Re: [HACKERS] JSON manipulation functions

2010-05-25 Thread Magnus Hagander
On Tue, May 25, 2010 at 12:57, Robert Haas wrote: > On Tue, May 25, 2010 at 5:37 AM, Joseph Adams > wrote: >> I started a wiki article for brainstorming the JSON API: >> http://wiki.postgresql.org/wiki/JSON_API_Brainstorm .  I also made >> substantial changes to the draft of the API based on disc

Re: [HACKERS] JSON manipulation functions

2010-05-25 Thread Robert Haas
On Tue, May 25, 2010 at 5:37 AM, Joseph Adams wrote: > I started a wiki article for brainstorming the JSON API: > http://wiki.postgresql.org/wiki/JSON_API_Brainstorm .  I also made > substantial changes to the draft of the API based on discussion here > and on the #postgresql IRC channel. > > Is i

Re: [HACKERS] JSON manipulation functions

2010-05-25 Thread Joseph Adams
I started a wiki article for brainstorming the JSON API: http://wiki.postgresql.org/wiki/JSON_API_Brainstorm . I also made substantial changes to the draft of the API based on discussion here and on the #postgresql IRC channel. Is it alright to use the wiki for brainstorming, or should it stay on

Re: [HACKERS] JSON manipulation functions

2010-05-14 Thread Pavel Stehule
2010/5/14 Tom Lane : > Robert Haas writes: >> On Thu, May 13, 2010 at 9:47 PM, Joseph Adams >> wrote: >>> [] retrieves a value of a JSON array/object by (one-based) index.  In >>> other words, value[n] is equivalent to selecting the nth row of >>> json_values(value) (provided value is of type JSO

Re: [HACKERS] JSON manipulation functions

2010-05-14 Thread Robert Haas
On Fri, May 14, 2010 at 10:35 PM, Joseph Adams wrote: > By the way, I'm considering making it so JSON arrays will be treated > like objects when it comes to -> and the json_keys function.  Thus, > json_keys('[1,4,9,16,25]') would yield '{1,2,3,4,5}', and > ('[1,4,9,16,25]'::JSON) -> 3 would yield

Re: [HACKERS] JSON manipulation functions

2010-05-14 Thread Joseph Adams
On Fri, May 14, 2010 at 11:33 AM, Bruce Momjian wrote: > Joseph Adams wrote: >> == array/object conversion == >> >> The json_object function converts a tuple to a JSON object.  If there >> are duplicate column names, there will be duplicate keys in the >> resulting JSON object. >> >> json_object([

Re: [HACKERS] JSON manipulation functions

2010-05-14 Thread Tom Lane
Robert Haas writes: > On Thu, May 13, 2010 at 9:47 PM, Joseph Adams > wrote: >> [] retrieves a value of a JSON array/object by (one-based) index.  In >> other words, value[n] is equivalent to selecting the nth row of >> json_values(value) (provided value is of type JSON).  Examples: >> >> SELECT

Re: [HACKERS] JSON manipulation functions

2010-05-14 Thread Mike Rylander
On Fri, May 14, 2010 at 1:15 PM, Robert Haas wrote: > On Thu, May 13, 2010 at 9:47 PM, Joseph Adams > wrote: [snip] >> == array/object conversion == >> >> The json_object function converts a tuple to a JSON object.  If there >> are duplicate column names, there will be duplicate keys in the >>

Re: [HACKERS] JSON manipulation functions

2010-05-14 Thread Robert Haas
On Thu, May 13, 2010 at 9:47 PM, Joseph Adams wrote: > The following function returns the type of any JSON value. > > json_type as enum ('null', 'string', 'number', 'boolean', 'object', 'array') > json_type(json) returns json_type Seems reasonable. > Would it be a bad idea to give an enum and a

Re: [HACKERS] JSON manipulation functions

2010-05-14 Thread Pavel Stehule
2010/5/14 Bruce Momjian : > Joseph Adams wrote: >> == array/object conversion == >> >> The json_object function converts a tuple to a JSON object.  If there >> are duplicate column names, there will be duplicate keys in the >> resulting JSON object. >> >> json_object([content [AS name] [, ...]]) re

Re: [HACKERS] JSON manipulation functions

2010-05-14 Thread Bruce Momjian
Joseph Adams wrote: > == array/object conversion == > > The json_object function converts a tuple to a JSON object. If there > are duplicate column names, there will be duplicate keys in the > resulting JSON object. > > json_object([content [AS name] [, ...]]) returns json > > Likewise, the jso

[HACKERS] JSON manipulation functions

2010-05-13 Thread Joseph Adams
First off, thank you for allowing me to participate in Google Summer of Code 2010. I'm sorry I haven't been active for the past few weeks. Today, I added the wiki page for my project, but the project schedule is highly tentative: http://wiki.postgresql.org/wiki/JSON_datatype_GSoC_2010 . I'd like