Re: Function args: TEXT -vs- VARCHAR?

From: Sergey Konoplev <gray(dot)ru(at)gmail(dot)com>
To: "Craig R(dot) Skinner" <skinner(at)britvault(dot)co(dot)uk>
Cc: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Function args: TEXT -vs- VARCHAR?
Date: 2013-11-13 03:07:51
Message-ID: CAL_0b1uY+gX-z6Pkpeoxd87k+eeONVKU4A4NC4Z56+Jr1TkAWg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Tuesday, November 12, 2013, Craig R. Skinner wrote:

> When writing (9.2) PostgreSQL functions, is it preferable to have text
> or character varying args?
>
> The tables the functions are updating/inserting into have character
> varying columns.
>
> I've used both in various places & want to unify.
>
> Using character varying with an over length arg causes the function to
> bomb out on calling, which seems the logical thing to do as the table
> can't accept the data anyway.
>
> Thoughts?

There is a good article about this
http://www.depesz.com/2010/03/02/charx-vs-varcharx-vs-varchar-vs-text/.

> --
> Craig Skinner | http://twitter.com/Craig_Skinner | http://linkd.in/yGqkv7
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org <javascript:;>)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>

--
Kind regards,
Sergey Konoplev
PostgreSQL Consultant and DBA

http://www.linkedin.com/in/grayhemp
+1 (415) 867-9984, +7 (901) 903-0499, +7 (988) 888-1979
gray(dot)ru(at)gmail(dot)com

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Craig R. Skinner 2013-11-13 13:03:08 Re: Function args: TEXT -vs- VARCHAR?
Previous Message Luca Vernini 2013-11-12 18:23:29 Re: Function args: TEXT -vs- VARCHAR?