Search Postgresql Archives

Re: Maximum size for char or varchar with limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/08/2010 08:04 AM, Tom Lane wrote:
Adrian Klaver<adrian.klaver@xxxxxxxxx>  writes:
So the answer is, it depends on your encoding.

No, it doesn't.  What Rob is looking for is this bit in htup.h:

/*
  * MaxAttrSize is a somewhat arbitrary upper limit on the declared size of
  * data fields of char(n) and similar types.  It need not have anything
  * directly to do with the *actual* upper limit of varlena values, which
  * is currently 1Gb (see TOAST structures in postgres.h).  I've set it
  * at 10Mb which seems like a reasonable number --- tgl 8/6/00.
  */
#define MaxAttrSize		(10 * 1024 * 1024)

The rationale for having a limit of this sort is (a) we *don't* want
the upper limit of declarable length to be encoding-dependent; and
(b) if you are trying to declare an upper limit that's got more than a
few digits in it, you almost certainly ought to not be declaring a limit
at all.

			regards, tom lane

Well that explains it :) Would it be possible to change the below section in the docs to state that the declared max value of n is limited to a max string size of 10Mb? I have always taken it to mean that the max value was calculated based off the encoding. Then again it might just be me.

"The maximum value that will be allowed for n in the data type declaration is less than that. It wouldn't be useful to change this because with multibyte character encodings the number of characters and bytes can be quite different."

--
Adrian Klaver
adrian.klaver@xxxxxxxxx

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux