Inconsistent error message for varchar(n)

Поиск
Список
Период
Сортировка
От Japin Li
Тема Inconsistent error message for varchar(n)
Дата
Msg-id MEYP282MB1669613B56A4CBFCAA8E8425B6969@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM
обсуждение исходный текст
Ответы Re: Inconsistent error message for varchar(n)  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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.



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Re: Logical Replication - improve error message while adding tables to the publication in check_publication_add_relation
Следующее
От: Japin Li
Дата:
Сообщение: Invalid Unicode escape value at or near "\u0000"