Revision 2096
Added by Aaron Marcuse-Kubitza over 12 years ago
lib/sql.py | ||
---|---|---|
516 | 516 |
else: raise NotImplementedError("Can't list constraint columns for "+module+ |
517 | 517 |
' database') |
518 | 518 |
|
519 |
row_num_col = '_row_num' |
|
520 |
|
|
519 | 521 |
def add_row_num(db, table): |
520 |
'''Adds a row number column named `row_num` to a table'''
|
|
522 |
'''Adds a row number column to a table. Its name is in row_num_col.'''
|
|
521 | 523 |
check_name(table) |
522 |
run_query(db, 'ALTER TABLE '+table+' ADD COLUMN row_num serial NOT NULL') |
|
524 |
run_query(db, 'ALTER TABLE '+table+' ADD COLUMN '+row_num_col |
|
525 |
+' serial NOT NULL') |
|
523 | 526 |
|
524 | 527 |
def tables(db, schema='public', table_like='%'): |
525 | 528 |
module = util.root_module(db.db) |
Also available in: Unified diff
sql.py: add_row_num(): Name the column "_row_num" so that it doesn't conflict with any "row_num" column that's part of the table schema