Re: 7.0.2 cuts off attribute name
От | Tom Lane |
---|---|
Тема | Re: 7.0.2 cuts off attribute name |
Дата | |
Msg-id | 14622.960996222@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: 7.0.2 cuts off attribute name (Niall Smart <niall.smart@ebeon.com>) |
Список | pgsql-hackers |
Niall Smart <niall.smart@ebeon.com> writes: >> 7.0 has a new behavior of *telling* you that it's truncating overlength >> identifiers, but the system has always truncated 'em. > You think it should fail with an error message instead? ;) > I think that PostgreSQL must tell the user when it is doing > something as significant as truncating a name. But the point is that it is *not* significant, at least not in 99.99% of cases. Truncating identifiers has been a standard compiler practice for decades, and nobody emits warnings when they do it. The reason it's not significant is that there is no problem unless you actually have a conflict caused by truncation, and in that scenario you will get an appropriate error message. For example: create table foo (a_very_very_really_long_identifier_foo int, a_very_very_really_long_identifier_bar float); NOTICE: identifier "a_very_very_really_long_identifier_foo" will be truncated to "a_very_very_really_long_identif" NOTICE: identifier "a_very_very_really_long_identifier_bar" will be truncated to "a_very_very_really_long_identif" ERROR: CREATE TABLE: attribute "a_very_very_really_long_identif" duplicated Now when you get an error like that, it doesn't take a rocket scientist to figure out that the problem is the system's only paying attention to the first N characters; do you really need the "help" of the notices for that? The rest of the time, when there isn't a naming conflict, the notices are just useless noise. I have never heard of another programming language implementation that emits notices when truncating overlength identifiers to fit in its symbol table. The reason why Postgres is alone in doing this is *not* that we're smarter than everybody else. regards, tom lane
В списке pgsql-hackers по дате отправления: