hasura / hasura/graphql-engine

When could Hasura support customized extensions with double decision functions T-T

Open
#7,167 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Function like this... I got a hundred of them
```
CREATE OR REPLACE FUNCTION public.queen_weights(fid character varying, geom character varying, ordcont integer, incloord boolean, precthreshold real, colname character varying, tablename character varying)
RETURNS TABLE(w bytea)
LANGUAGE plpgsql
STABLE
AS $function$
BEGIN
EXECUTE 'ALTER TABLE '|| tableName ||' ADD COLUMN IF NOT EXISTS '|| colName ||' bytea;';
EXECUTE '
WITH tmp_w AS (
SELECT
geoda_weights_cont('|| fid ||', '|| geom ||', TRUE, '|| ordCont ||', '|| incLoOrd || ', '|| precThreshold ||') AS w
FROM '|| tableName ||'
)
UPDATE '|| tableName ||' ta SET '|| colName ||' = tb.w
FROM (
SELECT
geoda_weights_getfids(w) AS fid,
geoda_weights_toset(w) AS w
FROM tmp_w
) AS tb
WHERE ta.'||fid||' = tb.fid';
RETURN QUERY EXECUTE
'SELECT '|| geom ||' w FROM ' || tableName ||' ORDER BY '|| fid;
END;
$function$
```
Thanks in advance!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.