Revision 10345
Added by Aaron Marcuse-Kubitza over 11 years ago
schemas/util.sql | ||
---|---|---|
1395 | 1395 |
new text[] = ARRAY(SELECT util.map_values(names)); |
1396 | 1396 |
BEGIN |
1397 | 1397 |
old = old[1:array_length(new, 1)]; -- truncate to same length |
1398 |
PERFORM util.try_create($$ALTER TABLE $$||$1||$$ RENAME $$
|
|
1399 |
||quote_ident(key)||$$ TO $$||quote_ident(value))
|
|
1398 |
PERFORM util.eval($$ALTER TABLE $$||$1||$$ RENAME $$||quote_ident(key)
|
|
1399 |
||$$ TO $$||quote_ident(value)) |
|
1400 | 1400 |
FROM each(hstore(old, new)) |
1401 | 1401 |
WHERE value != key -- not same name |
1402 | 1402 |
; |
Also available in: Unified diff
bugfix: schemas/util.sql: set_col_names(): need to generate error if destination column already exists (rather than suppressing it with try_create()), because this indicates a collision