fix: Location header with a null PK on a view (#1875)

Regression after #1475
This commit is contained in:
laurenceisla
2021-06-18 18:09:19 -05:00
committed by GitHub
parent 1b12b112a1
commit 59e0b006a5
4 changed files with 35 additions and 2 deletions
+1 -1
View File
@@ -172,7 +172,7 @@ asBinaryF fieldName = "coalesce(string_agg(_postgrest_t." <> pgFmtIdent fieldNam
locationF :: [Text] -> SqlFragment
locationF pKeys = [qc|(
WITH data AS (SELECT row_to_json(_) AS row FROM {sourceCTEName} AS _ LIMIT 1)
SELECT array_agg(json_data.key || '=eq.' || json_data.value)
SELECT array_agg(json_data.key || '=' || coalesce('eq.' || json_data.value, 'is.null'))
FROM data CROSS JOIN json_each_text(data.row) AS json_data
WHERE json_data.key IN ('{fmtPKeys}')
)|]