Revision 12683
Added by Aaron Marcuse-Kubitza almost 11 years ago
trunk/schemas/util.sql | ||
---|---|---|
728 | 728 |
|
729 | 729 |
|
730 | 730 |
-- |
731 |
-- Name: coalesce(anyarray); Type: FUNCTION; Schema: util; Owner: - |
|
732 |
-- |
|
733 |
|
|
734 |
CREATE FUNCTION "coalesce"(VARIADIC values_ anyarray) RETURNS anyelement |
|
735 |
LANGUAGE sql IMMUTABLE |
|
736 |
AS $_$ |
|
737 |
SELECT value |
|
738 |
FROM unnest($1) value |
|
739 |
WHERE value IS NOT NULL |
|
740 |
LIMIT 1 |
|
741 |
$_$; |
|
742 |
|
|
743 |
|
|
744 |
-- |
|
745 |
-- Name: FUNCTION "coalesce"(VARIADIC values_ anyarray); Type: COMMENT; Schema: util; Owner: - |
|
746 |
-- |
|
747 |
|
|
748 |
COMMENT ON FUNCTION "coalesce"(VARIADIC values_ anyarray) IS ' |
|
749 |
uses: |
|
750 |
* coalescing array elements or rows together |
|
751 |
* forcing evaluation of all values of a COALESCE() |
|
752 |
'; |
|
753 |
|
|
754 |
|
|
755 |
-- |
|
731 | 756 |
-- Name: col__min(col_ref); Type: FUNCTION; Schema: util; Owner: - |
732 | 757 |
-- |
733 | 758 |
|
Also available in: Unified diff
schemas/util.sql: added coalesce(anyarray), which can be used to force evaluation of all values of a COALESCE