Revision 5396
Added by Aaron Marcuse-Kubitza about 12 years ago
lib/sql.py | ||
---|---|---|
908 | 908 |
if in_place: |
909 | 909 |
assert cond == None |
910 | 910 |
|
911 |
changes = [(c, v, db.col_info(sql_gen.with_default_table(c, table), |
|
912 |
cacheable_).type) for c, v in changes] |
|
911 | 913 |
query = 'ALTER TABLE '+table.to_str(db)+'\n' |
912 |
query += ',\n'.join(('ALTER COLUMN '+c.to_str(db)+' TYPE ' |
|
913 |
+db.col_info(sql_gen.with_default_table(c, table), cacheable_).type |
|
914 |
+'\nUSING '+v.to_str(db) for c, v in changes)) |
|
914 |
query += ',\n'.join(('ALTER COLUMN '+c.to_str(db)+' TYPE '+t+'\nUSING ' |
|
915 |
+v.to_str(db) for c, v, t in changes)) |
|
915 | 916 |
else: |
916 | 917 |
query = 'UPDATE '+table.to_str(db)+'\nSET\n' |
917 | 918 |
query += ',\n'.join((c.to_str(db)+' = '+v.to_str(db) |
Also available in: Unified diff
sql.py: mk_update(): in_place: Factored retrieval of column type out into separate statement for clarity