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));
                            ^

postgres=# CREATE TABLE tbl (s varchar(2147483648));
ERROR:  syntax error at or near "2147483648"
LINE 1: CREATE TABLE tbl (s varchar(2147483648));
                                    ^

I find that in gram.y the varchar has an integer parameter which
means its value don't exceed 2147483647.

The first error message is reported by anychar_typmodin(), and the later
is reported by gram.y.  IMO, the syntax error for varchar(n) is more
confused.

Any thoughts?

-- 
Regrads,
Japin Li.
ChengDu WenWu Information Technology Co.,Ltd.


Reply via email to