Обсуждение: CREATE DOMAIN json vs built-in json

Поиск
Список
Период
Сортировка

CREATE DOMAIN json vs built-in json

От
Hitoshi Harada
Дата:
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


Re: CREATE DOMAIN json vs built-in json

От
Abel Abraham Camarillo Ojeda
Дата:
On Tue, Mar 20, 2012 at 2:44 AM, Hitoshi Harada <umi.tanuki@gmail.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...


Re: CREATE DOMAIN json vs built-in json

От
Abel Abraham Camarillo Ojeda
Дата:
On Tue, Mar 20, 2012 at 2:47 AM, Abel Abraham Camarillo Ojeda
<acamari@verlet.org> wrote:
> On Tue, Mar 20, 2012 at 2:44 AM, Hitoshi Harada <umi.tanuki@gmail.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=#


Re: CREATE DOMAIN json vs built-in json

От
Tom Lane
Дата:
Hitoshi Harada <umi.tanuki@gmail.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