Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4e00ffdf6 | ||
|
|
cd62e39cd1 | ||
|
|
ec0f99c686 | ||
|
|
b2cd365866 | ||
|
|
fcc330311f | ||
|
|
e557161b84 | ||
|
|
962268fd6b |
@@ -147,7 +147,7 @@ jobs:
|
||||
- name: Check static executable
|
||||
run: postgrest-check-static result/bin/postgrest
|
||||
- name: Save built executable as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: postgrest-linux-static-x64
|
||||
path: result/bin/postgrest
|
||||
@@ -156,7 +156,7 @@ jobs:
|
||||
- name: Build Docker image
|
||||
run: nix-build -A docker.image --out-link postgrest-docker.tar.gz
|
||||
- name: Save built Docker image as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: postgrest-docker-x64
|
||||
path: postgrest-docker.tar.gz
|
||||
@@ -218,7 +218,7 @@ jobs:
|
||||
- name: Build with Stack
|
||||
run: stack build --local-bin-path result --copy-bins
|
||||
- name: Save built executable as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.artifact }}
|
||||
path: |
|
||||
@@ -238,7 +238,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: .github/get_cirrusci_freebsd
|
||||
- name: Save executable as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: postgrest-freebsd-x64
|
||||
path: postgrest
|
||||
@@ -335,7 +335,7 @@ jobs:
|
||||
- name: Extract downloaded binaries
|
||||
run: tar -xvf result.tar.xz && rm result.tar.xz
|
||||
- name: Save aarch64 executable as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: postgrest-ubuntu-aarch64
|
||||
path: result/postgrest
|
||||
@@ -396,7 +396,7 @@ jobs:
|
||||
echo "Relevant extract from CHANGELOG.md:"
|
||||
cat CHANGES.md
|
||||
- name: Save CHANGES.md as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-changes
|
||||
path: CHANGES.md
|
||||
@@ -414,7 +414,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
- name: Create release bundle with archives for all builds
|
||||
@@ -445,7 +445,7 @@ jobs:
|
||||
artifacts/postgrest-windows-x64/postgrest.exe
|
||||
|
||||
- name: Save release bundle
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: release-bundle
|
||||
path: release-bundle
|
||||
@@ -484,7 +484,7 @@ jobs:
|
||||
with:
|
||||
tools: release
|
||||
- name: Download Docker image
|
||||
uses: actions/download-artifact@v3
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: postgrest-docker-x64
|
||||
- name: Publish images on Docker Hub
|
||||
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
postgrest-loadtest-against main ${{ steps.get-latest-tag.outputs.tag }}
|
||||
postgrest-loadtest-report > loadtest/loadtest.md
|
||||
- name: Upload report
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: loadtest.md
|
||||
path: loadtest/loadtest.md
|
||||
@@ -64,7 +64,7 @@ jobs:
|
||||
postgrest-loadtest-against ${{ steps.get-latest-tag.outputs.tag }}
|
||||
postgrest-loadtest-report > loadtest/loadtest.md
|
||||
- name: Upload report
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: loadtest.md
|
||||
path: loadtest/loadtest.md
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
steps:
|
||||
- name: Download from Artifacts
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
uses: dawidd6/action-download-artifact@v3
|
||||
with:
|
||||
workflow: ${{ github.event.workflow.name }}
|
||||
run_id: ${{github.event.workflow_run.id }}
|
||||
|
||||
+5
-1
@@ -35,7 +35,11 @@ PostgREST ongoing development is only possible thanks to our Sponsors and Backer
|
||||
<img width="296px" src="https://raw.githubusercontent.com/PostgREST/postgrest/main/static/supabase.png">
|
||||
</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://tembo.io/?utm_source=sponsor&utm_campaign=postgrest" target="_blank">
|
||||
<img width="296px" src="static/tembo.png">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -5,6 +5,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## Unreleased
|
||||
|
||||
## [12.0.2] - 2023-12-20
|
||||
|
||||
### Fixed
|
||||
|
||||
- #3124, Fix table's media type handlers not working for all schemas - @steve-chavez
|
||||
- #3126, Fix empty row on media type handler function - @steve-chavez
|
||||
|
||||
## [12.0.1] - 2023-12-12
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -46,7 +46,11 @@ API than you are likely to write from scratch.
|
||||
<img width="296px" src="https://raw.githubusercontent.com/PostgREST/postgrest/main/static/supabase.png">
|
||||
</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://tembo.io/?utm_source=sponsor&utm_campaign=postgrest" target="_blank">
|
||||
<img width="296px" src="static/tembo.png">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -43,7 +43,11 @@ write from scratch.
|
||||
<img width="296px" src="https://raw.githubusercontent.com/PostgREST/postgrest/main/static/supabase.png">
|
||||
</a>
|
||||
</td>
|
||||
<td></td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://tembo.io/?utm_source=sponsor&utm_campaign=postgrest" target="_blank">
|
||||
<img width="296px" src="https://raw.githubusercontent.com/PostgREST/postgrest/main/static/tembo.png">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
name: postgrest
|
||||
version: 12.0.1
|
||||
version: 12.0.2
|
||||
synopsis: REST API for any Postgres database
|
||||
description: Reads the schema of a PostgreSQL database and creates RESTful routes
|
||||
for tables, views, and functions, supporting all HTTP methods that security
|
||||
|
||||
@@ -157,7 +157,8 @@ preparePlanRows countQuery =
|
||||
standardRow :: Bool -> HD.Row ResultSet
|
||||
standardRow noLocation =
|
||||
RSStandard <$> nullableColumn HD.int8 <*> column HD.int8
|
||||
<*> (if noLocation then pure mempty else fmap splitKeyValue <$> arrayColumn HD.bytea) <*> column HD.bytea
|
||||
<*> (if noLocation then pure mempty else fmap splitKeyValue <$> arrayColumn HD.bytea)
|
||||
<*> (fromMaybe mempty <$> nullableColumn HD.bytea)
|
||||
<*> nullableColumn HD.bytea
|
||||
<*> nullableColumn HD.text
|
||||
<*> nullableColumn HD.int8
|
||||
|
||||
@@ -1167,7 +1167,7 @@ mediaHandlers pgVer =
|
||||
join pg_type arg_name on arg_name.oid = proc.proargtypes[0]
|
||||
join pg_namespace arg_schema on arg_schema.oid = arg_name.typnamespace
|
||||
where
|
||||
proc_schema.nspname = ANY('{test}') and
|
||||
proc_schema.nspname = ANY($1) and
|
||||
proc.pronargs = 1 and
|
||||
arg_name.oid in (select reltype from all_relations)
|
||||
union
|
||||
@@ -1182,7 +1182,8 @@ mediaHandlers pgVer =
|
||||
join pg_namespace pro_sch on pro_sch.oid = proc.pronamespace
|
||||
join media_types mtype on proc.prorettype = mtype.oid
|
||||
join pg_namespace typ_sch on typ_sch.oid = mtype.typnamespace
|
||||
where NOT proretset
|
||||
where
|
||||
pro_sch.nspname = ANY($1) and NOT proretset
|
||||
|] <> (if pgVer >= pgVersion110 then " AND prokind = 'f'" else " AND NOT (proisagg OR proiswindow)")
|
||||
|
||||
decodeMediaHandlers :: HD.Result MediaHandlerMap
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.7 MiB |
@@ -102,7 +102,7 @@ postJsonArrayTest(){
|
||||
|
||||
echo "Running memory usage tests.."
|
||||
|
||||
jsonKeyTest "1M" "POST" "/rpc/leak?columns=blob" "26M"
|
||||
jsonKeyTest "1M" "POST" "/rpc/leak?columns=blob" "27M"
|
||||
jsonKeyTest "1M" "POST" "/leak?columns=blob" "16M"
|
||||
jsonKeyTest "1M" "PATCH" "/leak?id=eq.1&columns=blob" "16M"
|
||||
|
||||
|
||||
@@ -119,6 +119,13 @@ spec = describe "custom media types" $ do
|
||||
, matchHeaders = ["Content-Type" <:> "application/json; charset=utf-8"]
|
||||
}
|
||||
|
||||
it "should not fail when the function doesn't return a row" $ do
|
||||
request methodGet "/rpc/get_line?id=777" (acceptHdrs "application/vnd.twkb") ""
|
||||
`shouldRespondWith` ""
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = ["Content-Type" <:> "application/vnd.twkb"]
|
||||
}
|
||||
|
||||
context "Proc that returns scalar based on a table" $ do
|
||||
it "can get an image with Accept: image/png" $ do
|
||||
r <- request methodGet "/rpc/ret_image" (acceptHdrs "image/png") ""
|
||||
|
||||
@@ -150,6 +150,20 @@ spec =
|
||||
matchStatus = 406
|
||||
}
|
||||
|
||||
it "succeeds in calling handler with a domain on another schema" $
|
||||
request methodGet "/another_table" [("Accept-Profile", "v2"), (hAccept, "text/plain")] ""
|
||||
`shouldRespondWith` "plain"
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = ["Content-Type" <:> "text/plain; charset=utf-8", "Content-Profile" <:> "v2"]
|
||||
}
|
||||
|
||||
it "succeeds in calling handler with a domain on an exposed schema" $
|
||||
request methodGet "/another_table" [("Accept-Profile", "v2"), (hAccept, "text/special")] ""
|
||||
`shouldRespondWith` "special"
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = ["Content-Type" <:> "text/special", "Content-Profile" <:> "v2"]
|
||||
}
|
||||
|
||||
context "calling procs on different schemas" $ do
|
||||
it "succeeds in calling the default schema proc" $
|
||||
request methodGet "/rpc/get_parents_below?id=6" [] ""
|
||||
@@ -194,6 +208,20 @@ spec =
|
||||
, matchHeaders = [matchContentTypeJson, "Content-Profile" <:> "v2"]
|
||||
}
|
||||
|
||||
it "succeeds in calling handler with a domain on another schema" $
|
||||
request methodGet "/rpc/get_plain_text" [("Accept-Profile", "v2"), (hAccept, "text/plain")] ""
|
||||
`shouldRespondWith` "plain"
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = ["Content-Type" <:> "text/plain; charset=utf-8", "Content-Profile" <:> "v2"]
|
||||
}
|
||||
|
||||
it "succeeds in calling handler with a domain on an exposed schema" $
|
||||
request methodGet "/rpc/get_special_text" [("Accept-Profile", "v2"), (hAccept, "text/special")] ""
|
||||
`shouldRespondWith` "special"
|
||||
{ matchStatus = 200
|
||||
, matchHeaders = ["Content-Type" <:> "text/special", "Content-Profile" <:> "v2"]
|
||||
}
|
||||
|
||||
context "Modifying tables on different schemas" $ do
|
||||
it "succeeds in patching on the v1 schema and returning its parent" $
|
||||
request methodPatch "/children?select=name,parent(name)&id=eq.1" [("Content-Profile", "v1"), ("Prefer", "return=representation")]
|
||||
|
||||
Vendored
+41
@@ -2169,6 +2169,42 @@ returns setof v2.parents as $$
|
||||
select * from v2.parents where id < $1;
|
||||
$$ language sql;
|
||||
|
||||
create function v2.get_plain_text()
|
||||
returns test."text/plain" as $$
|
||||
select 'plain'::test."text/plain";
|
||||
$$ language sql;
|
||||
|
||||
create domain v2."text/special" as text;
|
||||
|
||||
create function v2.get_special_text()
|
||||
returns v2."text/special" as $$
|
||||
select 'special'::v2."text/special";
|
||||
$$ language sql;
|
||||
|
||||
create or replace function v2.special_trans (state v2."text/special", next v2.another_table)
|
||||
returns v2."text/special" as $$
|
||||
select 'special'::v2."text/special";
|
||||
$$ language sql;
|
||||
|
||||
drop aggregate if exists v2.special_agg(v2.another_table);
|
||||
create aggregate v2.special_agg (v2.another_table) (
|
||||
initcond = ''
|
||||
, stype = v2."text/special"
|
||||
, sfunc = v2.special_trans
|
||||
);
|
||||
|
||||
create or replace function v2.plain_trans (state test."text/plain", next v2.another_table)
|
||||
returns test."text/plain" as $$
|
||||
select 'plain'::test."text/plain";
|
||||
$$ language sql;
|
||||
|
||||
drop aggregate if exists v2.plain_agg(v2.another_table);
|
||||
create aggregate v2.plain_agg (v2.another_table) (
|
||||
initcond = ''
|
||||
, stype = test."text/plain"
|
||||
, sfunc = v2.plain_trans
|
||||
);
|
||||
|
||||
create table private.screens (
|
||||
id serial primary key,
|
||||
name text not null default 'new screen'
|
||||
@@ -3481,6 +3517,11 @@ returns setof test.lines as $$
|
||||
select * from lines;
|
||||
$$ language sql;
|
||||
|
||||
create or replace function test.get_line (id int)
|
||||
returns "application/vnd.twkb" as $$
|
||||
select extensions.st_astwkb(geom)::"application/vnd.twkb" from lines where id = get_line.id;
|
||||
$$ language sql;
|
||||
|
||||
create or replace function test.get_shop_bles ()
|
||||
returns setof test.shop_bles as $$
|
||||
select * from shop_bles;
|
||||
|
||||
Reference in New Issue
Block a user