Re: CREATE TYPE similar CHAR type

From: Thom Brown <thom(at)linux(dot)com>
To: Mohsen SM <mohsensoodkhah(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: CREATE TYPE similar CHAR type
Date: 2014-03-06 12:02:45
Message-ID: CAA-aLv7EGhzdK=BnH7cUryKLBrKp3b3rYd-vC0S1hEyYc1gfpg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 6 March 2014 11:24, Mohsen SM <mohsensoodkhah(at)gmail(dot)com> wrote:

> I want use CREATE TYPE to create one type similar to char.
> I want to when I create type, then my type behave similar to char:
>
> CREATE TABLE test (oneChar char);
>
> when I want insert one column with length>1 to it, so it gets this error:
> ERROR: value too long for type character(1)
>
> I want my type behave similar this but it behaves similar varchar type.
>
>
If you did that, you'd have a char field padded out to fill up 10
megabytes-worth of characters. I doubt that's what you want.

It's not clear what you want this for though. If you want an arbitrary
number of characters, just use the text data type.
--
Thom

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2014-03-06 12:44:22 Next CommitFest Deadlines
Previous Message Mohsen SM 2014-03-06 11:24:01 CREATE TYPE similar CHAR type