Re: Function args: TEXT -vs- VARCHAR?

From: Luca Vernini <lucazeo(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-12 18:23:29
Message-ID: CAHZ=uVAOB9H9jS2BGnu9jDKosxapKY2_M+arf+-kC1fwCSgvfg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I like to have constraint, so I usually use character varying.
Anyway, there is no performance difference:
http://www.postgresql.org/docs/9.2/static/datatype-character.html

So use character varying just if you can, or if you must limit the input.

2013/11/12 Craig R. Skinner <skinner(at)britvault(dot)co(dot)uk>:
> 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?
> --
> Craig Skinner | http://twitter.com/Craig_Skinner | http://linkd.in/yGqkv7
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Sergey Konoplev 2013-11-13 03:07:51 Re: Function args: TEXT -vs- VARCHAR?
Previous Message Craig R. Skinner 2013-11-12 18:17:44 Function args: TEXT -vs- VARCHAR?