Re: [HACKERS] Re: [SQL] Column name's length - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Re: [SQL] Column name's length
Date
Msg-id 24896.928330916@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Re: [SQL] Column name's length  (wieck@debis.com (Jan Wieck))
List pgsql-hackers
wieck@debis.com (Jan Wieck) writes:
>     What  about building them from the tables OID plus the column
>     numbers.

The parser doesn't know what OID will be assigned to the table at the
time it builds the names for the derived objects.  I suppose we could
postpone the creation of these names until after the table OID is known,
but that looks like a rather large and risky change to be making at this
stage of the release cycle...

At this point I like Zalman's idea, which if I understood it properly
went like this:

1. If table and column name are short enough, use "table_column_key"  etc (so, no change in the cases that the system
acceptsnow).
 

2. Otherwise, truncate table and/or column name to fit, leaving room for  a few extra characters that are made from a
hashof the removed  characters.  The result would look something like "tab_col_5927_key".
 

This still isn't a 100% solution, but it's probably a 99.5% solution
where the simple truncation idea would be maybe 95%.  Not sure that
the additional coverage is worth making the names harder to predict
for a person, though.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Massimo Dal Zotto
Date:
Subject: Re: [HACKERS] nonblocking lock?
Next
From: wieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] Re: [SQL] Column name's length