Re: CREATE DOMAIN json vs built-in json

Lists: pgsql-hackers
From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: CREATE DOMAIN json vs built-in json
Date: 2012-03-20 08:44:18
Message-ID: CAP7QgmnVC_uZhGOTVbGbEjiBzjWkgswYCfVFYVHHNfxn9SZ=8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I've noticed our plv8 regression test now fails. It has CREATE DOMAIN
json AS text ... and validates text via v8's JSON.parse(), which was
working before introducing built-in json type. The test itself can be
solved simply by creating schema, but my surprise is that we allow a
domain whose name is the same as other base type. Is it intentional?

Thanks,
--
Hitoshi Harada


From: Abel Abraham Camarillo Ojeda <acamari(at)verlet(dot)org>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CREATE DOMAIN json vs built-in json
Date: 2012-03-20 08:47:57
Message-ID: CAPD=2NgxuoGEQWJuX-c5nAe+jYkB=4gqNGLZtqAyCrR3Q3mVPg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Mar 20, 2012 at 2:44 AM, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> wrote:
> I've noticed our plv8 regression test now fails.  It has CREATE DOMAIN
> json AS text ... and validates text via v8's JSON.parse(), which was
> working before introducing built-in json type.  The test itself can be
> solved simply by creating schema, but my surprise is that we allow a
> domain whose name is the same as other base type.  Is it intentional?
>
> Thanks,
> --
> Hitoshi Harada
>

Mmm...

_n_srv=# create domain text as text;
CREATE DOMAIN
_n_srv=#
_n_srv=# create domain int as text;
CREATE DOMAIN
_n_srv=#

Mmm...


From: Abel Abraham Camarillo Ojeda <acamari(at)verlet(dot)org>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CREATE DOMAIN json vs built-in json
Date: 2012-03-20 08:50:25
Message-ID: CAPD=2NjD+LLuQk+O3Q+_c4R+8-f0edeGqZppPb2bguSxQGfJ2Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Mar 20, 2012 at 2:47 AM, Abel Abraham Camarillo Ojeda
<acamari(at)verlet(dot)org> wrote:
> On Tue, Mar 20, 2012 at 2:44 AM, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> wrote:
>> I've noticed our plv8 regression test now fails.  It has CREATE DOMAIN
>> json AS text ... and validates text via v8's JSON.parse(), which was
>> working before introducing built-in json type.  The test itself can be
>> solved simply by creating schema, but my surprise is that we allow a
>> domain whose name is the same as other base type.  Is it intentional?
>>
>> Thanks,
>> --
>> Hitoshi Harada
>>
>
> Mmm...
>
> _n_srv=# create domain text as text;
> CREATE DOMAIN
> _n_srv=#
> _n_srv=# create domain int as text;
> CREATE DOMAIN
> _n_srv=#
>
> Mmm...

$ psql -U postgres _n_srv
psql (9.1.2)
Type "help" for help.

_n_srv=#


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CREATE DOMAIN json vs built-in json
Date: 2012-03-20 13:52:56
Message-ID: 24204.1332251576@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com> writes:
> I've noticed our plv8 regression test now fails. It has CREATE DOMAIN
> json AS text ... and validates text via v8's JSON.parse(), which was
> working before introducing built-in json type. The test itself can be
> solved simply by creating schema, but my surprise is that we allow a
> domain whose name is the same as other base type. Is it intentional?

Sure. The built-in type is in the pg_catalog schema, but your domain
is (most likely) being created in the public schema.

regards, tom lane