Skip site navigation (1) Skip section navigation (2)

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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Dave Page" <dpage(at)pgadmin(dot)org>
Cc: "eric melbardis" <eric(dot)melbardis(at)netkitsolutions(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4056: problem creating function with domain argument
Date: 2008-03-27 17:52:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-bugs
"Dave Page" <dpage(at)pgadmin(dot)org> writes:
> On Tue, Mar 25, 2008 at 5:37 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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=# SELECT oid, format_type(oid, typtypmod) AS typname FROM
> pg_type where oid = '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

In response to


pgsql-bugs by date

Next:From: Eric P. MelbardisDate: 2008-03-27 18:03:07
Subject: Re: BUG #4056: problem creating function with domain argument
Previous:From: Eugen.KonkovDate: 2008-03-27 16:18:41
Subject: Re: Extra empty lines PGv8.3.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group