-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2190124
commit cc9cfe2
Showing
3 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
WITH pgrst_source AS ( | ||
SELECT "get_projects_below".* | ||
FROM ( | ||
SELECT '[{"id": 4}]'::json as json_data | ||
) pgrst_payload, | ||
LATERAL ( | ||
SELECT CASE WHEN json_typeof(pgrst_payload.json_data) = 'array' THEN pgrst_payload.json_data ELSE json_build_array(pgrst_payload.json_data) END AS val | ||
) pgrst_uniform_json, | ||
LATERAL ( | ||
SELECT * FROM json_to_recordset(pgrst_uniform_json.val) AS _("id" integer) LIMIT 1 | ||
) pgrst_args, | ||
LATERAL "test"."get_projects_below"("id" := pgrst_args.id) | ||
) | ||
SELECT | ||
null::bigint AS total_result_set, | ||
pg_catalog.count(_postgrest_t) AS page_total, | ||
coalesce(json_agg(_postgrest_t), '[]')::character varying AS body, | ||
nullif(current_setting('response.headers', true), '') AS response_headers, | ||
nullif(current_setting('response.status', true), '') AS response_status | ||
FROM (SELECT "projects".* FROM "pgrst_source" AS "projects") _postgrest_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
WITH pgrst_source AS ( | ||
WITH | ||
pgrst_payload AS (SELECT '{"id": 4}'::json AS json_data), | ||
pgrst_body AS ( SELECT CASE WHEN json_typeof(json_data) = 'array' THEN json_data ELSE json_build_array(json_data) END AS val FROM pgrst_payload), | ||
pgrst_args AS ( SELECT * FROM json_to_recordset((SELECT val FROM pgrst_body)) AS _("id" integer) ) | ||
SELECT "get_projects_below".* | ||
FROM "test"."get_projects_below"("id" := (SELECT "id" FROM pgrst_args LIMIT 1)) | ||
) | ||
SELECT | ||
null::bigint AS total_result_set, | ||
pg_catalog.count(_postgrest_t) AS page_total, | ||
coalesce(json_agg(_postgrest_t), '[]')::character varying AS body, | ||
nullif(current_setting('response.headers', true), '') AS response_headers, | ||
nullif(current_setting('response.status', true), '') AS response_status | ||
FROM (SELECT "projects".* FROM "pgrst_source" AS "projects") _postgrest_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters