On 09/28/2012 08:22 AM, Peter Eisentraut wrote:
>> (3) Invent an auxiliary type along the lines of "json_value" and say
>> that you create a cast from foo to json_value when you want one
>> interpretation, or directly to json if you want the other. Then
>> things like record_to_json would look for the appropriate type of cast.
>> This is a bit ugly because the auxiliary type has no reason to live
>> other than to separate the two kinds of cast, but it avoids creating
>> any new JSON-specific mechanisms in the type system.
> What if some wanted to create a yaml type as an extension. How would
> they associate yaml and yaml_value?
Well, of course it wouldn't be a problem if the code could know the OID
of yaml_value ... :-)
cheers
andrew