Revision 10157
Added by Aaron Marcuse-Kubitza over 11 years ago
schemas/util.sql | ||
---|---|---|
1255 | 1255 |
DECLARE |
1256 | 1256 |
row_ util.map; |
1257 | 1257 |
BEGIN |
1258 |
FOR row_ IN |
|
1259 |
EXECUTE $$DELETE FROM $$||names||$$ WHERE "from" LIKE ':%' RETURNING *$$ |
|
1258 |
FOR row_ IN EXECUTE $$SELECT * FROM $$||names||$$ WHERE "from" LIKE ':%'$$ |
|
1260 | 1259 |
LOOP |
1261 | 1260 |
PERFORM util.mk_const_col((table_, row_."to"), |
1262 | 1261 |
substring(row_."from" from 2)); |
... | ... | |
1272 | 1271 |
-- |
1273 | 1272 |
|
1274 | 1273 |
COMMENT ON FUNCTION set_col_names_with_metadata(table_ regclass, names regclass) IS 'idempotent. |
1275 |
deletes metadata mappings from names table.';
|
|
1274 |
the metadata mappings must be *last* in the names table.';
|
|
1276 | 1275 |
|
1277 | 1276 |
|
1278 | 1277 |
-- |
Also available in: Unified diff
schemas/util.sql: set_col_names_with_metadata(): don't delete the metadata entries from the map table, because they are now added before the renames take place, so that the renames can simply be performed on the constant columns themselves. this does, however, require that the metadata entries are always listed last in the map.csv (which is currently the case).