Re: 7.0.2 cuts off attribute name

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Niall Smart <niall(dot)smart(at)ebeon(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: 7.0.2 cuts off attribute name
Date: 2000-06-14 15:23:42
Message-ID: 14622.960996222@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Niall Smart <niall(dot)smart(at)ebeon(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-06-14 15:28:43 Re: 7.0.2 cuts off attribute name
Previous Message Arrigo Triulzi 2000-06-14 15:22:04 OSF/1/Digital UNIX/Tru64 UNIX spinlock code