Revision 10309
Added by Aaron Marcuse-Kubitza over 11 years ago
schemas/util.sql | ||
---|---|---|
1245 | 1245 |
AS $_$ |
1246 | 1246 |
SELECT util.try_create($$ALTER TABLE $$||$1||$$ RENAME $$ |
1247 | 1247 |
||quote_ident(name)||$$ TO $$||quote_ident($2 -> name)) |
1248 |
FROM util.col_names($1::text::regtype) f (name) |
|
1248 |
FROM util.col_names($1::text::regtype) f (name); |
|
1249 |
SELECT NULL::void; -- don't fold away functions called in previous query |
|
1249 | 1250 |
$_$; |
1250 | 1251 |
|
1251 | 1252 |
|
Also available in: Unified diff
bugfix: schemas/util.sql: rename_cols(): run additional `SELECT NULL::void` query after the main for-loop query so that PostgreSQL does not try to fold away the execution of util.try_create() just because multiple rows are not returned by the function. the result set of the first query will still be discarded, but will be fully evaluated. (this has nothing to do with VOLATILE vs. IMMUTABLE; util.try_create() is already declared VOLATILE and would normally not be folded.) rename_cols() is used to rename derived columns, which are not part of the map.csv and cannot be positionally renamed.