Revision 5394
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/sql_io.py | ||
---|---|---|
26 | 26 |
table = sql_gen.as_Table(table) |
27 | 27 |
cols = filter(lambda c: sql_gen.is_text_col(db, c), |
28 | 28 |
sql.table_cols(db, table)) |
29 |
try: cols.remove(sql.pkey_col(db, table)) |
|
30 |
except ValueError: pass |
|
29 |
try: pkey_col = sql.table_pkey_col(db, table) |
|
30 |
except sql.DoesNotExistException: pass |
|
31 |
else: |
|
32 |
try: cols.remove(pkey_col) |
|
33 |
except ValueError: pass |
|
31 | 34 |
if not cols: return |
32 | 35 |
|
33 | 36 |
db.log_debug('Cleaning up table', level=1.5) |
Also available in: Unified diff
sql_io.py: cleanup_table(): Use sql.table_pkey_col() instead of sql.pkey_col() so that only an actual pkey column is removed from the list of columns to clean. This fixes a bug where the first column in the table was not cleaned up if there was no pkey. Note that this bug only affected newly re-created staging tables, because staging tables previously had a special row_num pkey column added if they did not already have a pkey. The row_num column is now added by column-based import instead.