Re: [HACKERS] Re: [SQL] Column name's length

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: Jan Wieck <jwieck(at)debis(dot)com>
Cc: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-hackers(at)postgreSQL(dot)org, zalman(at)netcom(dot)com
Subject: Re: [HACKERS] Re: [SQL] Column name's length
Date: 1999-06-02 15:19:17
Message-ID: 199906021519.LAA21996@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> >
> > > How about something like this: if the code finds that the names are
> > > too long when forming an implicit index name, it truncates the names
> > > to fit, and you are OK as long as the truncated name is unique.
> > > Comments? Objections? I think I could argue that this is a bug fix
> > > and deserves to be slipped into 6.5 ;-)
> >
> > I understand some folks think this is a problem, but have been
> > reluctant to include a "randomizer" in the created index name since it
> > would make the index name less clearly predictable. May as well use
> > something like "idx_<procid>_<timestamp>" or somesuch...
> >
> > No real objection though, other than aesthetics. And those only count
> > for so much...
>
> I've been wondering for some time why at all to build the
> index and sequence names from those table/fieldnames. Only to
> make them guessable?
>
> What about building them from the tables OID plus the column
> numbers. That way, auto created sequences could also be
> automatically removed on a DROP TABLE because the system can
> "guess" them.

Another idea would be to truncate table and column names equally to fit
in NAMEDATALEN, then if that is not unique, start replacing the last
letters of the string with number until it is unique:

tabnamecolname
tabnamecolnam1
tabnamecolnam2
tabnamecolna32

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-06-02 15:31:40 Re: [HACKERS] 6.4.2/AIX: syslog support seems alright ?
Previous Message Oleg Bartunov 1999-06-02 15:05:05 Re: [HACKERS] PID of backend