Revision 10352
Added by Aaron Marcuse-Kubitza over 11 years ago
schemas/util.sql | ||
---|---|---|
1120 | 1120 |
|
1121 | 1121 |
CREATE FUNCTION map_nulls(nulls anyarray, value anyelement) RETURNS anyelement |
1122 | 1122 |
LANGUAGE sql IMMUTABLE STRICT |
1123 |
SET search_path TO util |
|
1124 | 1123 |
AS $_$ |
1125 |
SELECT _map(($1 => NULL) || '*=>*', $2)
|
|
1124 |
SELECT util._map(util.hstore($1, NULL) || '*=>*', $2)
|
|
1126 | 1125 |
$_$; |
1127 | 1126 |
|
1128 | 1127 |
|
Also available in: Unified diff
schemas/util.sql: inlinable IMMUTABLE functions: avoid using config params (e.g. `SET search_path TO util`) because these prevent dynamic inlining (i.e. inlining of a function call with variable instead of constant arguments, by substituting the arguments into the function's body). dynamic inlining can speed up function evaluation significantly, because a (slow) call to a user-defined SQL function is avoided.