Skip to content

Instantly share code, notes, and snippets.

View mfakhrusy's full-sized avatar
🐌
imagine setting up github status

M Fahru mfakhrusy

🐌
imagine setting up github status
View GitHub Profile
CREATE OR REPLACE FUNCTION public.document_count_categories()
RETURNS TABLE(output_ancestor_name text, output_all_document numeric, output_verified_document numeric, output_revision_document numeric)
LANGUAGE plpgsql
AS $function$
declare
parent_category_id UUID;
begin
FOR parent_category_id IN
SELECT category_id FROM categories where parent_id is null
LOOP
with recursive category_tree AS (
select category_id, "name", ARRAY[]::UUID[] AS ancestors
from categories WHERE parent_id IS NULL
union all
select categories.category_id, categories."name", category_tree.ancestors || categories.parent_id
from categories, category_tree
where categories.parent_id = category_tree.category_id
), document_count_per_sub_category as (
select
d.document_name as "name",
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
==> Making package: silo 4.10.2-6 (Sun Mar 5 10:38:03 WIB 2017)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
-> Found silo-4.10.2.tar.gz
-> Found silo-4.10.2-rocket-test.patch
-> Found silo-4.10.2-skip-test.patch
-> Found silo-4.10.2-remove-mpiposix.patch
==> Validating source files with sha256sums...
silo-4.10.2.tar.gz ... Passed