Revision 12734
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/schemas/util.sql | ||
---|---|---|
3447 | 3447 |
CREATE FUNCTION set_col_types(table_ regclass, col_casts col_cast[]) RETURNS void |
3448 | 3448 |
LANGUAGE sql |
3449 | 3449 |
AS $_$ |
3450 |
SELECT util.eval($$ALTER TABLE $$||$1||$$ |
|
3450 |
SELECT util.eval(COALESCE( |
|
3451 |
$$ALTER TABLE $$||$1||$$ |
|
3451 | 3452 |
$$||( |
3452 | 3453 |
SELECT |
3453 | 3454 |
string_agg($$ALTER COLUMN $$||col_name_sql||$$ TYPE $$||target_type |
... | ... | |
3462 | 3463 |
FROM unnest($2) |
3463 | 3464 |
) s |
3464 | 3465 |
WHERE curr_type != target_type |
3465 |
)) |
|
3466 |
), ''))
|
|
3466 | 3467 |
$_$; |
3467 | 3468 |
|
3468 | 3469 |
|
Also available in: Unified diff
bugfix: schemas/util.sql: set_col_types(): need to COALESCE the executed SQL to '' because util.eval() does not support NULL (and shouldn't, because this indicates a missing COALESCE in constructing the statement)