Re: Maximum size for char or varchar with limit - Mailing list pgsql-general

From Tom Lane
Subject Re: Maximum size for char or varchar with limit
Date
Msg-id 15790.1291824247@sss.pgh.pa.us
Whole thread Raw
In response to Re: Maximum size for char or varchar with limit  (Adrian Klaver <adrian.klaver@gmail.com>)
Responses Re: Maximum size for char or varchar with limit
Re: Maximum size for char or varchar with limit
List pgsql-general
Adrian Klaver <adrian.klaver@gmail.com> 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

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Asynchronous query execution
Next
From: Rob Gansevles
Date:
Subject: Re: Maximum size for char or varchar with limit