From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Joseph Adams <joeyadams3(dot)14159(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Should the JSON datatype be a specialization of text? |
Date: | 2010-06-17 19:00:49 |
Message-ID: | AANLkTikqLblvHKBDO5atn55VEQjcm5RsvdqPqGYAEcV5@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Jun 17, 2010 at 12:52 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Thu, Jun 17, 2010 at 11:25 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> I'm
>>> inclined to think that associating #2 with casts might be better,
>>> because clearly casting numerics or bools to JSON ought to act like #2.
>>> If we do it as you suggest then casting text to JSON behaves differently
>>> from casting anything else to JSON.
>
>> I think this is going to turn into a thicket of semantic ambiguity.
>
> True. Maybe it would be better to *not have* casts as such between JSON
> and non-text data types, but make you write something like
> json_literal(numeric)
> to get a JSON literal representing a value. Then json_literal(text)
> would do an unsurprising thing (analogous to quote_literal), and we
> could use the casts between text and json for the behavior where the
> text is interpreted as a valid JSON object.
Yep, I agree. Except you need a way to generate not only JSON objects
that are quoted strings, but also hashes, arrays, booleans, numbers,
and nulls...
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Smith | 2010-06-17 19:43:58 | Re: ANNOUNCE list (was Re: New PGXN Extension site) |
Previous Message | Alvaro Herrera | 2010-06-17 18:50:15 | Re: Explicit psqlrc |