Re: Function args: TEXT -vs- VARCHAR?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: skinner(at)britvault(dot)co(dot)uk (Craig R(dot) Skinner)
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Function args: TEXT -vs- VARCHAR?
Date: 2013-11-13 16:36:42
Message-ID: 6365.1384360602@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

skinner(at)britvault(dot)co(dot)uk (Craig R. Skinner) writes:
> On 2013-11-13 Wed 06:34 AM |, Adrian Klaver wrote:
>> The full SQL type syntax is allowed for input arguments and return
>> value. However, some details of the type specification (e.g., the
>> precision field for type numeric) are the responsibility of the
>> underlying function implementation and are silently swallowed (i.e.,
>> not recognized or enforced) by the CREATE FUNCTION command.

> That's rather vague..... "... some details ..."

What's ignored by CREATE FUNCTION (and, indeed, pretty much the entire
type inference mechanism) is typmod. So any parenthesized modifier for
a type name is not considered. Usually those are length/precision
constraints, but user-defined types might do something else with them.

> An explicit table of datatype & what's "silently swallowed" would be
> valuable to clarify this topic that's said to be often repeatedly asked.

Can't be asked that often, as that text has been untouched for more
than a dozen years ...

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David Johnston 2013-11-13 17:14:06 Re: Function args: TEXT -vs- VARCHAR?
Previous Message Craig R. Skinner 2013-11-13 15:51:13 Re: Function args: TEXT -vs- VARCHAR?