Re: Function args: TEXT -vs- VARCHAR?

From: David Johnston <polobo(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Function args: TEXT -vs- VARCHAR?
Date: 2013-11-13 17:59:42
Message-ID: 1384365582722-5778200.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane-2 wrote
> David Johnston &lt;

> polobo@

> &gt; writes:
>> Tom Lane-2 wrote
>>> skinner(at)(dot)co (Craig R. Skinner) writes:
>>>> 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 ...
>
>> s/some/parenthetical/ ?
>
> [ thinks for a bit ] Actually, the existing text is wrong/misleading
> in another way, since it implies that a PL implementation *could* enforce
> parameter typmods if it wanted. It can't, because the information isn't
> even stored by CREATE FUNCTION. So we do need to do something about this
> text. Perhaps something like this:
>
> The full SQL type syntax is allowed for declaring a function's arguments
> and return value. However, parenthesized type modifiers (e.g., the
> precision field for type numeric) are discarded by CREATE FUNCTION. Thus
> for example "CREATE FUNCTION foo (varchar(10)) ..." is exactly the same as
> "CREATE FUNCTION foo (varchar) ...".

+1

FWIW I have always read that as "if you care about stuff like precision and
text lengths you have to deal with it yourself inside your function." Not
that the PL implementation itself would be capable to doing something with
the information. Since CREATE FUNCTION was doing the stripping I reasoned
out the actual PL language interpreter never even saw the info.

David J.

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Function-args-TEXT-vs-VARCHAR-tp5777968p5778200.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Craig R. Skinner 2013-11-13 18:04:36 Re: Function args: TEXT -vs- VARCHAR?
Previous Message Tom Lane 2013-11-13 17:51:59 Re: Function args: TEXT -vs- VARCHAR?