Forum OpenACS Q&A: Response to text versus varchar data types

Collapse
Posted by Andrei Popov on
An emperical test:
$ psql _tmp
_tmp=# create table t (f varchar(1000000));
CREATE
_tmp=# \q

$ python
Python 2.1 (#1, Apr 17 2001, 09:45:01)
[GCC 2.95.3-2 (cygwin special)] on cygwin_nt-4.01
Type "copyright", "credits" or "license" for more information.
>>>a='A'*100000
>>>from pg import DB
>>> cnx=DB('_tmp','localhost')
>>> qstr = 'insert into t values (\'' + '123' +'\');'
>>> cnx.query(qstr)
2826034
>>> a = 'A'*65535
>>> qstr = 'insert into t values (\'' + '123' +'\');'
>>> cnx.query(qstr)
2826060
>>> a = 'A'*1000000
>>> qstr = 'insert into t values (\'' + '123' +'\');'
>>> cnx.query(qstr)
2826061
>>> ^D

$ psql _tmp
_tmp=# select length(f) from t;
 length
---------
   65535
 1000000
  100000
(3 rows)

_tmp=# select substring(f,64000,1) from t;
 substring
-----------
 A
 A
 A
(3 rows)

_tmp=# drop table t;
DROP
_tmp=# \q
$
Looks like no limit, eh?