Revision 6222
Added by Aaron Marcuse-Kubitza over 12 years ago
schemas/functions.sql | ||
---|---|---|
139 | 139 |
|
140 | 140 |
|
141 | 141 |
-- |
142 |
-- Name: _map(hstore, text); Type: FUNCTION; Schema: functions; Owner: - |
|
143 |
-- |
|
144 |
|
|
145 |
CREATE FUNCTION _map(map hstore, value text) RETURNS text |
|
146 |
LANGUAGE plpgsql IMMUTABLE |
|
147 |
AS $$ |
|
148 |
DECLARE |
|
149 |
match text := map -> value; |
|
150 |
default_ text := map -> '*'; |
|
151 |
BEGIN |
|
152 |
IF match IS NOT NULL THEN RETURN match; |
|
153 |
ELSIF default_ = '*' THEN RETURN value; |
|
154 |
ELSE RETURN default_; |
|
155 |
END IF; |
|
156 |
END; |
|
157 |
$$; |
|
158 |
|
|
159 |
|
|
160 |
-- |
|
142 | 161 |
-- Name: _max(anyelement, anyelement, anyelement, anyelement, anyelement, anyelement, anyelement, anyelement, anyelement, anyelement); Type: FUNCTION; Schema: functions; Owner: - |
143 | 162 |
-- |
144 | 163 |
|
Also available in: Unified diff
schemas/functions.sql: Added _map(), which uses the new hstore functionality. This expands _map() functionality to column-based import.