Re: Inconsistent error message for varchar(n)

2022-08-31 Thread Bruce Momjian
8On Tue, Aug 16, 2022 at 09:56:17PM -0400, Bruce Momjian wrote: > On Sun, Nov 14, 2021 at 10:33:19AM +0800, Japin Li wrote: > > Oh! I didn't consider this situation. Since the max size of varchar cannot > > exceed 10485760, however, I cannot find this in documentation [1]. Is there > > something I

Re: Inconsistent error message for varchar(n)

2022-08-16 Thread Bruce Momjian
On Sun, Nov 14, 2021 at 10:33:19AM +0800, Japin Li wrote: > > On Sat, 13 Nov 2021 at 23:42, Tom Lane wrote: > > Japin Li writes: > >> postgres=# CREATE TABLE tbl (s varchar(2147483647)); > >> ERROR: length for type varchar cannot exceed 10485760 > >> LINE 1: CREATE TABLE tbl (s varchar(21474836

Re: Inconsistent error message for varchar(n)

2021-11-14 Thread Dagfinn Ilmari Mannsåker
Tom Lane writes: > Tracking it a bit further, the actual typmod limit is set by this: > > /* > * 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

Re: Inconsistent error message for varchar(n)

2021-11-14 Thread Tom Lane
I wrote: > For comparison, it doesn't bring up the point that string values are > constrained to 1GB; that's dealt with elsewhere. Since the limit on > typmod is substantially more than that, I'm not sure there's much point > in mentioning it specifically. Oh, wait, I was not counting the zeroes

Re: Inconsistent error message for varchar(n)

2021-11-14 Thread Tom Lane
[ Please trim quotes appropriately when replying. Nobody wants to read the whole history of the thread to get to your comment. ] Japin Li writes: > Oh! I didn't consider this situation. Since the max size of varchar cannot > exceed 10485760, however, I cannot find this in documentation [1]. I

Re: Inconsistent error message for varchar(n)

2021-11-13 Thread Japin Li
On Sat, 13 Nov 2021 at 23:42, Tom Lane wrote: > Japin Li writes: >> postgres=# CREATE TABLE tbl (s varchar(2147483647)); >> ERROR: length for type varchar cannot exceed 10485760 >> LINE 1: CREATE TABLE tbl (s varchar(2147483647)); >> ^ > >> postgres=# CREATE TABLE t

Re: Inconsistent error message for varchar(n)

2021-11-13 Thread Tom Lane
Japin Li writes: > postgres=# CREATE TABLE tbl (s varchar(2147483647)); > ERROR: length for type varchar cannot exceed 10485760 > LINE 1: CREATE TABLE tbl (s varchar(2147483647)); > ^ > postgres=# CREATE TABLE tbl (s varchar(2147483648)); > ERROR: syntax error at or

Inconsistent error message for varchar(n)

2021-11-12 Thread Japin Li
Hi, hackers When I try to create table that has a varchar(n) data type, I find an inconsistent error message for it. postgres=# CREATE TABLE tbl (s varchar(2147483647)); ERROR: length for type varchar cannot exceed 10485760 LINE 1: CREATE TABLE tbl (s varchar(2147483647));