Skip to content

Instantly share code, notes, and snippets.

@mydreambei-ai
Created September 29, 2016 02:40
Show Gist options
  • Save mydreambei-ai/d31b483b19c830eee280f136bda13821 to your computer and use it in GitHub Desktop.
Save mydreambei-ai/d31b483b19c830eee280f136bda13821 to your computer and use it in GitHub Desktop.
postgresql custom aggregate function
create or replace function lmy(first INTEGER, item INTEGER) returns INTEGER as $$
BEGIN
return first * item;
END;
$$
LANGUAGE plpgsql;
create aggregate yml(INTEGER) (
sfunc = lmy,
stype = INTEGER,
initcond = 1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment