tmp commit
This commit is contained in:
@@ -203,3 +203,20 @@ BEGIN
|
||||
RETURN result;
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
|
||||
|
||||
-- Create a function that always returns the first non-NULL item
|
||||
CREATE OR REPLACE FUNCTION public.first_agg ( anyelement, anyelement )
|
||||
RETURNS anyelement LANGUAGE SQL IMMUTABLE STRICT AS $$
|
||||
SELECT $1;
|
||||
$$;
|
||||
|
||||
DROP AGGREGATE IF EXISTS public.FIRST (anyelement);
|
||||
|
||||
-- And then wrap an aggregate around it
|
||||
CREATE AGGREGATE public.FIRST (
|
||||
sfunc = public.first_agg,
|
||||
basetype = anyelement,
|
||||
stype = anyelement
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user