Project

General

Profile

« Previous | Next » 

Revision 2609

sql_gen.py: add_suffix(): Preserve version so that it won't be truncated off the string, leading to collisions

View differences:

lib/sql_gen.py
12 12
identifier_max_len = 63 # works for both PostgreSQL and MySQL
13 13

  
14 14
def add_suffix(str_, suffix):
15
    '''Preserves version so that it won't be truncated off the string, leading
16
    to collisions.'''
17
    if len(str_) == identifier_max_len: # preserve version
18
        str_, sep, version = str_.partition('#')
19
        suffix = sep+version+suffix
15 20
    return strings.add_suffix(str_, suffix, identifier_max_len)
16 21

  
17 22
def is_safe_name(name):

Also available in: Unified diff