Thread: Identifier gets truncated

Identifier gets truncated

From
Peter Kroon
Date:
When an identifier has more then 63 chars it gets truncated.
This is fine.
However PostgreSQL fails to notice that it might truncate to an identifier which already exist.
Does PostgreSQL got a setting that will never create a duplicate identifier?

really_long_name_table_A -> really_long_na
really_long_name_table_B -> really_long_na

Peter

Re: Identifier gets truncated

From
Bruce Momjian
Date:
On Thu, Jan 10, 2013 at 03:36:32PM +0100, Peter Kroon wrote:
> When an identifier has more then 63 chars it gets truncated.
> This is fine.
> However PostgreSQL fails to notice that it might truncate to an identifier
> which already exist.
> Does PostgreSQL got a setting that will never create a duplicate identifier?
>
> really_long_name_table_A -> really_long_na
> really_long_name_table_B -> really_long_na

Well, if an indenfier truncates to a name that conflicts with another
one, you will get an error:

 test=> create table test(
 test(>
x1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111int, 
 test(>
x1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112int); 
 NOTICE:  identifier
"x1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111"will
betruncated to "x11111111111111111111111111111111111111111111111111111111111111" 
 NOTICE:  identifier
"x1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111112"will
betruncated to "x11111111111111111111111111111111111111111111111111111111111111" 
 ERROR:  column "x11111111111111111111111111111111111111111111111111111111111111" specified more than once

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +