varchar

Started by Alain Rogerover 19 years ago2 messagesgeneral
Jump to latest
#1Alain Roger
raf.news@gmail.com

Hi,

I would like to allow web site user to fill a field and for that i would
need a large varchar()...maybe something around 100.000 characters.
i guess that VARCHAR can not hold so many character and that i should turn
to bytea.
Am I right or is there some other possibility ?

i'm asking that because i've seen that bytea has some issues to store non
ASCII characters like from UNICODE andSlovak language...

so how can i store central europe characters (UNICODE) into BYTEA field ?

thx,

Alain

#2Alexander Staubo
alex@purefiction.net
In reply to: Alain Roger (#1)
Re: varchar

On Nov 5, 2006, at 15:32 , Alain Roger wrote:

I would like to allow web site user to fill a field and for that i
would need a large varchar()...maybe something around 100.000
characters.
i guess that VARCHAR can not hold so many character and that i
should turn to bytea.
Am I right or is there some other possibility ?

Not at all -- PostgreSQL can fit roughly 1 gigabyte of data in a
single varchar column. Avoid bytea for anything except purely binary
data. Keep in mind that PostgreSQL is not able to index values longer
than ~ 8 kilobytes.

Note that the "text" data type, which is unlimited in length by
definition, is usually preferred over varchar. Read more here:

http://www.postgresql.org/docs/8.1/interactive/datatype-
character.html

Alexander.