BUG #11103: to_json() does not convert correctly DOMAINs type since 9.3.5 (int expected instead of string) ?

From: dgrelaud(at)ideolys(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #11103: to_json() does not convert correctly DOMAINs type since 9.3.5 (int expected instead of string) ?
Date: 2014-07-31 15:24:56
Message-ID: 20140731152456.2708.35688@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 11103
Logged by: David GRELAUD
Email address: dgrelaud(at)ideolys(dot)com
PostgreSQL version: 9.3.5
Operating system: Ubuntu 12.04 or Mac OS X 10.9
Description:

Hi,

The function to_json() does not convert correctly (= as before) DOMAINs
since 9.3.5. It was OK in 9.3.4.

Here is a minimal test case :

CREATE DOMAIN UNSIGNED_INT4 AS INT4 CHECK (VALUE >= 0);
SELECT to_json(2::UNSIGNED_INT4);

With 9.3.5, it returns a JSON string : '2' (with quotes)
With 9.3.4, it returns a JSON int : 2 (without quotes)

The same behavior happens with array_to_json() and maybe others related
functions...

If we do not use domains, SELECT to_json(2::INT4) returns always a JSON int
(even with 9.3.5).

Is it related to the change made by Tom Lane?
commit 0ca6bda8e7501947c05f30c127f6d12ff90b5a64 and the release note 9.3.5
"Fix identification of input type category in to_json() and friends (Tom
Lane)"?

Is it volontary? If so, don't worry, I will find a workaround.

Thank you very much for maintaining this wonderfull Open Source database.

David.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message desmodemone 2014-07-31 15:57:38 Re: Is this a bug?
Previous Message Bruce Momjian 2014-07-31 14:25:59 Re: BUG #10991: psql -c ignores my pager settings in ~/.psqlrc