Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ? - Mailing list pgsql-hackers

From Hannu Krosing
Subject Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ?
Date
Msg-id 1336160694.19151.85.camel@hvost
Whole thread Raw
In response to Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ?  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Fri, 2012-05-04 at 13:43 -0400, Robert Haas wrote:
> On Fri, May 4, 2012 at 12:56 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> > Andrew Dunstan <andrew@dunslane.net> writes:
> >> Yeah, what I've been thinking about in conjunction with similar problems
> >> is some sort of type registry, so that we could code for non-builtin
> >> types in certain cases. Maybe we should add that the the developers'
> >> meeting agenda.
> >
> > Maybe.  I don't want to see a json-specific hack for this, but some sort
> > of generic way to add type knowledge could be useful, if we could figure
> > out what we want.
> 
> For this particular case, I think you just need some place to store a
> pg_type -> pg_proc mapping.  I'm not exactly sure how to make that not
> a JSON-specific hack, since I certainly don't think we'd want to add a
> new catalog just for that.

This was my initial proposal to have casts to ::json for all types.

I backed out from this in favot of generic to_json(datum, indent) in
order to support prettyprinting.

> -- 
> Robert Haas
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
> 




pgsql-hackers by date:

Previous
From: Jan Urbański
Date:
Subject: Re: PL/Python result set slicing broken in Python 3
Next
From: Hannu Krosing
Date:
Subject: Re: JSON in 9.2 - Could we have just one to_json() function instead of two separate versions ?