From: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Oid registry |
Date: | 2012-09-25 17:28:25 |
Message-ID: | 20120925172824.GA12035@svana.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Sep 25, 2012 at 09:18:30AM -0400, Andrew Dunstan wrote:
> >I'm not at all familiar with record_to_json or the json datatype,
> >but wouldn't it be appropriate to create a cast from hstore to
> >json to handle that case?
>
> No, the difficulty (or at least the first difficulty) is in having
> the code recognize that it has an hstore at all. The code picks
> apart the record field by field at run time and takes various
> actions depending on the field's type. For any type it doesn't
> recognize it just outputs the value as a string, and so that's what
> it does with hstore. Mostly this is the right thing but in the
> hstore case it's rather sad.
Is there a particular reason to special case hstore though? Wouldn't it
be sufficient to simply look for a cast from the given type oid to json
and use that if present.
If you don't like cast, allow other extensions to define a function
to_json_hook(yourtype) -> json which is used.
Hardcoding IDs in extensions just doesn't seem right somehow...
(Hmm, I see someone else in the thread pointed this out too).
Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.
-- Arthur Schopenhauer
From | Date | Subject | |
---|---|---|---|
Next Message | md@rpzdesign.com | 2012-09-25 18:01:27 | Re: Switching timeline over streaming replication |
Previous Message | Andrew Dunstan | 2012-09-25 16:29:50 | Re: Oid registry |