From: | Zalman Stern <zalman(at)netcom(dot)com> |
---|---|
To: | tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) |
Cc: | pgsql-hackers(at)postgreSQL(dot)org, zalman(at)netcom(dot)com |
Subject: | Re: [HACKERS] Re: [SQL] Column name's length |
Date: | 1999-06-01 23:34:59 |
Message-ID: | 199906012335.QAA28839@netcom15.netcom.com |
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.
> For example
>
> create table averylongtablename (averylongfieldname serial);
>
> would truncate the input names to produce something like
>
> averylongtable_averylongfie_key
> averylongtable_averylongfie_seq
>
> and you'd only get a failure if those indexes/sequences already existed.
> (Truncating both names as shown above, not just the field name,
> should reduce the probability of collisions.)
This only partially solves the problem and can introduce bugs into code
which is only reading from a database. When someone is setting up the
database to work on the system, they'll in theory get a failure so they
know it won't work. This really isn't true for our software though because
we have functions which dynamically query a table to see what columns it
has. In theory two queries for different longnames can resolve to the same
column name.
It is also a backwards compatibility hassle if you ever want to increase
the number of significant characters in the name. This is because the
existing database only knows the first 32 characters and *must* ignore
anything after that in lookups. You would have to keep track of which names
are "old style" and which are new. Why set yourself up like that?
-Z-
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Bitmead | 1999-06-02 00:50:11 | Re: [HACKERS] ALTER TABLE ADD COLUMN |
Previous Message | Tom Lane | 1999-06-01 21:52:34 | Re: [HACKERS] Re: [SQL] Column name's length |