Re: varchar vs char vs text
| От | Tom Lane |
|---|---|
| Тема | Re: varchar vs char vs text |
| Дата | |
| Msg-id | 24880.1013550313@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Re: varchar vs char vs text ("Brett W. McCoy" <bmccoy@chapelperilous.net>) |
| Ответы |
Re: varchar vs char vs text
|
| Список | pgsql-novice |
"Brett W. McCoy" <bmccoy@chapelperilous.net> writes:
> I'd go with text. It's not SQL92, though.
Check.
> varchar is technically supposed to have a limit of 255,
Certainly not; the spec says
The maximum value of <length> is implementation-defined.
There may be implementations that are lame enough to limit it to 255,
but Postgres isn't one of them. IIRC, we set a rather arbitrary upper
limit of 10000000 on the length (mainly on the theory that anything
larger is either a typo, or you really don't want a limit at all, in
which case you oughta be using text).
At least in 7.2, it also works to say just "varchar" with no length
limit; this is functionally equivalent to "text" except perhaps for
some corner cases involving ambiguous-data-type resolution. But
this is not SQL-spec-compliant either.
regards, tom lane
В списке pgsql-novice по дате отправления: