Revision 3319
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
510 | 510 |
constraint, table = match.groups() |
511 | 511 |
cols = [] |
512 | 512 |
if recover: # need auto-rollback to run index_cols() |
513 |
try: cols = index_cols(db, table, constraint)
|
|
513 |
try: cols = index_cols(db, constraint) |
|
514 | 514 |
except NotImplementedError: pass |
515 | 515 |
raise DuplicateKeyException(constraint, cols, e) |
516 | 516 |
|
... | ... | |
1025 | 1025 |
if not_null_col in table_cols(db, table, recover): return not_null_col |
1026 | 1026 |
else: return pkey(db, table, recover) |
1027 | 1027 |
|
1028 |
def index_cols(db, table, index):
|
|
1028 |
def index_cols(db, index): |
|
1029 | 1029 |
'''Can also use this for UNIQUE constraints, because a UNIQUE index is |
1030 | 1030 |
automatically created. When you don't know whether something is a UNIQUE |
1031 | 1031 |
constraint or a UNIQUE index, use this function.''' |
Also available in: Unified diff
sql.py: index_cols(): Removed unneeded table param, since the index name is unique within its schema. (The schema is looked up in the search_path if needed, by using ::regclass.)