Re: Limited varchar, unlimited varchar, or text? - Mailing list pgsql-general

From Dmitry Tkach
Subject Re: Limited varchar, unlimited varchar, or text?
Date
Msg-id 3F1FF569.3000908@openratings.com
Whole thread Raw
In response to Limited varchar, unlimited varchar, or text?  (Curtis Hawthorne <mr_person@mrperson.org>)
Responses Re: Limited varchar, unlimited varchar, or text?  ("scott.marlowe" <scott.marlowe@ihs.com>)
List pgsql-general
>
>
> After looking at the docs on the
>character datatypes I noticed that if you don't specify a limit on the varchar
>type it will accept strings of any length.  If that's the case, what's the
>difference between it and text?
>
>
Actually, I'd like to know this too :-)
I think that there is no difference really...

But what confuses me is - why are there two completely separate types?
Is it just to keep the standards happy?
Or is there some hidden difference in the behaviour?
For example, there used to be a 'datetime' in 7.2, that was just an
alias for timestamp without timezone -
so that:
create table times (t timestamp without time zone, d datetime);
 \d times
 Column |            Type             | Modifiers
--------+-----------------------------+-----------
 t      | timestamp without time zone |
 d      | timestamp without time zone |


But if I try the same thing with text and varchar, I get two different
type - text and character varying...

Could somebody who knows shed some light on this?

Thanks!

Dima



pgsql-general by date:

Previous
From:
Date:
Subject: Re: List last value of all sequences
Next
From: Tom Lane
Date:
Subject: Re: quoting of array elements + sexp_out?