hasura / hasura/graphql-engine

Support arbitrary return type for custom SQL functions

Open
#4,098 7 comments 15 reactions 0 assignees View on GitHub
c/server p/medium
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

According to [Hasura documentation](https://hasura.io/docs/1.0/graphql/manual/schema/custom-functions.html#creating-exposing-sql-functions), only `SETOF ` is a valid return type for Hasura to be able to track custom functions. A helpful note recommends creating an empty table as a workaround. But this imposes a lot of extra development and schema management.

Would it be easy to support custom / on-the-fly table definitions? For example:

```
CREATE OR REPLACE FUNCTION test_function()
RETURNS TABLE(intFirst INT, bSecond BOOLEAN, randomData JSONB) AS $$

SELECT 1, TRUE, '{"fake": "data"}'::JSONB;

$$ LANGUAGE SQL STABLE;
```

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.