Re: BUG #4056: problem creating function with domain argument

Поиск
Список
Период
Сортировка
От Eric P. Melbardis
Тема Re: BUG #4056: problem creating function with domain argument
Дата
Msg-id EF3FC357692A7A418A0D4CA7ACE7F4F20241FCC6@mail.netkitsolutions.com
обсуждение исходный текст
Ответ на BUG #4056: problem creating function with domain argument  ("eric melbardis" <eric.melbardis@netkitsolutions.com>)
Список pgsql-bugs
Hi

Just a question..

The type was declared as follows:

CREATE DOMAIN "dt_0" AS varchar(32)
    NULL;

So why does the query respond with 36?

Regards

-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]=20
Sent: Thursday, March 27, 2008 10:53 AM
To: Dave Page
Cc: Eric P. Melbardis; pgsql-bugs@postgresql.org
Subject: Re: [BUGS] BUG #4056: problem creating function with domain
argument=20

"Dave Page" <dpage@pgadmin.org> writes:
> On Tue, Mar 25, 2008 at 5:37 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> ... It looks to me like pgAdmin is mistakenly
>> thinking that a domain has type modifiers.

> pgAdmin is using format_type() with a query like:

> postgres=3D# SELECT oid, format_type(oid, typtypmod) AS typname FROM
> pg_type where oid =3D 'dt_0'::regtype;
>   oid  | typname
> -------+----------
>  35130 | dt_0(36)
> (1 row)

> I would expect it to format the type appropriately.

No, the above is entirely wrong.  typtypmod is the typmod that goes with
the domain's base type, not with the domain itself.  You got away with
this mistaken code before 8.3 because format_type just silently ignored
its typmod argument for all but a very small number of types.  But now
the default behavior is to print the typmod.

When looking at a domain type, format_type(typbasetype,typtypmod)
would be a sane thing to do.  But that typmod isn't to be attached
to the domain itself.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4056: problem creating function with domain argument
Следующее
От: "Dave Page"
Дата:
Сообщение: Re: BUG #4056: problem creating function with domain argument