steve-chavez
0961a587c0
Correct openapi ignore-privs table comments
2021-07-06 11:19:54 -05:00
laurenceisla and GitHub
67c2ed7c62
feat: Show comprehensive error when an RPC is not found in a stale schema cache ( #1841 )
...
* Add 300 response for overloaded functions with same argument names but different types
* Add Path type to handle validations and errors before defining the Target
2021-07-06 09:19:26 -05:00
steve-chavez
f3a184af01
Correct openapi ignore mode to filter schemas
...
Also rename openapi-mode options
* follow-acl -> follow-privileges
* ignore-acl -> ignore-privileges
2021-06-27 22:48:49 -05:00
Steve Chavez and GitHub
41d119b19f
feat: add openapi-mode config ( #1881 )
...
* openapi-mode="follow-acl"(default): follows access control for the
JWT role.
* openapi-mode="ignore-acl": ignores access control for the JWT role.
* openapi-mode="disabled": disables OpenAPI output, the root endpoint
replies with 404 Not Found.
2021-06-25 19:20:04 -05:00
laurenceisla and GitHub
59e0b006a5
fix: Location header with a null PK on a view ( #1875 )
...
Regression after #1475
2021-06-18 18:09:19 -05:00
laurenceisla and GitHub
1b12b112a1
fix: Add a hint and clarification to the no relationship found error ( #1858 )
2021-05-31 12:15:31 -05:00
steve-chavez
d99909c403
feat: request.spec GUC for db-root-spec
...
The request.spec GUC contains the schema cache structure in json.
It's only available when the root endpoint(/) is requested and when
db-root-spec is not empty.
Also correct db-root-spec to accept a schema.
2021-05-30 16:48:08 -05:00
steve-chavez
f169661ce6
refactor: move DbStructure.PgVersion to Config
...
Now that PgVersion is not part of DbStructure, Config is a more apt
module for it.
Also rename getDbStructure to queryDbStructure. AppState also had a
getDbStructure function for a record field.
2021-05-30 16:48:08 -05:00
Laurence Isla and Wolfgang Walther
b4ca70708a
fix: Fix requests for overloaded functions from html forms to no longer hang
...
Fixes #1846
2021-05-13 10:07:49 +02:00
laurenceisla and GitHub
f6b3a5cc22
fix: Make OPTIONS consider view instead of triggers ( #1824 )
2021-04-23 18:12:43 -05:00
steve-chavez
082da78f4c
fix: disregard internal junction when embedding
...
Added test cases for a lone internal junction and an internal junction
exposed homonym
2021-04-21 10:28:20 -05:00
laurenceisla and GitHub
4b46c4eff3
feat: Add explicit headers-only POST request using Prefer header
...
Allows using header "Prefer=headers-only" explicitly to get a response with only a Location header.
BREAKING CHANGE: Change default for POST request from headers-only to minimal
Resolves #1656
2021-04-14 00:14:12 +02:00
Remo Rechkemmer and GitHub
801e229c59
refactor: Carve CLI and Version modules out of Config ( #1806 )
2021-04-12 19:17:47 +02:00
Remo Rechkemmer and GitHub
f99fd6cbad
refactor: Split up Types.hs and logically organize modules ( #1793 )
2021-04-11 18:28:01 +02:00
7f11c1a991
fix: Void functions return null instead of empty body ( #1795 )
...
* Change empty body reponse to null for scalar functions returning void or null values
* Add test for functions returning an integer with null value
Co-authored-by: Laurence Isla <lau.isla.c@gmail.com >
2021-04-08 01:45:13 +02:00
Robert Vollmert and Steve Chavez
3a466aea9a
tests: don't match JSON bodies literally
...
The change of hash function with hashable-1.3.1.0 changes object
ordering in JSON output, causing some test failures:
https://app.circleci.com/pipelines/github/PostgREST/postgrest/805/workflows/067844c9-9ce4-49e8-8790-315625ab309b/jobs/8309
e.g.:
> expected: "[{\"b\":\"baz\",\"a\":\"bar\"}]"
> but got: "[{\"a\":\"bar\",\"b\":\"baz\"}]"
This changes the tests to not compare against the body literally,
and instead use the ResponseMatcher instance from Test.Hspec.Wai.JSON.
2021-03-14 12:45:02 -05:00
Wolfgang Walther and GitHub
c7f0d42323
Add postgrest-coverage to show and upload hpc reports to codecov
2020-12-30 13:22:25 +01:00
Wolfgang Walther and GitHub
2015688312
Fix spec test concurrency issue related to tx=commit on simple_pk
2020-12-29 23:58:37 +01:00
Wolfgang Walther and Wolfgang Walther
dbe3c163bd
run spec tests in parallel
...
reduces time to run postgrest-test-spec-all by 20-25%
2020-12-14 00:42:03 +01:00
Wolfgang Walther and Wolfgang Walther
0c25f12825
fix: fix output of RPCs returning scalar values with multiple rows
...
resolves #1584
BREAKING CHANGE:
Changed output of RPCs to match return type better:
* single scalar return: value (unchanged)
* setof scalar return: array of values (new; was array of objects)
* single composite return: object (new; was array of objects)
* setof composite return: array of objects (unchanged)
* void return: nothing (new; was "null")
A single OUT column is now treated as "composite" instead of "scalar",
i.e. consistent with multiple OUT columns.
2020-12-10 19:55:42 +01:00
Wolfgang Walther
093fd3c8f6
fix: fix embedding through views with subqueries inside function calls
...
resolves #1608
Refactors the pfkSourceColumns query to use an intermediate JSON format
for parsing. This allows much more robust extraction of source columns.
2020-12-10 19:48:05 +01:00
Wolfgang Walther and GitHub
609c9aead8
Make transaction-rollback=true the default for test-suite ( #1663 )
...
Change test-suite to use db-tx-rollback-all = true by default
2020-12-03 18:54:33 +01:00
steve-chavez
4bd5e6bd82
perf: enable prepared statements for GET
...
- Parametrize filters
- Parametrize LIMIT/OFFSET
- Parametrize JSON path(select=col->$1)
- Single parameter for IN(use ANY)
- Also enable prepared statement for the EXPLAIN
used on the estimated count.
2020-11-23 19:00:50 -05:00
Wolfgang Walther and Steve Chavez
dbf99c6ac1
Add support for Prefer tx=rollback
2020-11-22 18:21:06 -05:00
Wolfgang Walther and Steve Chavez
944efb3a6a
Split StructureSpec into OpenApiSpec and OptionsSpec
2020-11-20 11:51:49 -05:00
Wolfgang Walther and Steve Chavez
2c52b96e04
Refactor tests: replace str with json QuasiQuoter where appropriate
2020-11-20 09:24:32 -05:00
Wolfgang Walther and Steve Chavez
e08bb3a197
Fix overloading of functions with unnamed arguments (specifically for prefer params=single-object)
2020-11-20 09:24:32 -05:00
Wolfgang Walther and Steve Chavez
b091586394
Refactor tests: renaming json table to prevent hiding of native json type
2020-11-20 09:24:32 -05:00
Wolfgang Walther and Steve Chavez
ca7ffd0a70
Fix RPC return type handling for domains with composite base type
2020-11-20 09:24:32 -05:00
Gergely Mészáros and GitHub
3f690ec78f
Removing single column limit from join table M2M mapping detection. ( #1593 )
2020-11-17 18:49:02 -05:00
Wolfgang Walther and GitHub
6e04fe7454
Enable embedding through multiple layers of views recursively ( #1625 )
...
* Include hidden views from the search path. Hidden views are views in unexposed schemas that are part of a view dependency chain.
* Change allSourceColumns to only return pk and fk columns
2020-11-15 14:58:57 -05:00
Wolfgang Walther and Steve Chavez
122fea1507
Add test to insert into a view and expect location header return
2020-11-03 10:43:06 -05:00
Wolfgang Walther and Steve Chavez
a7403fecc2
refactor: split InsertSpec into InsertSpec and UpdateSpec
2020-11-03 10:43:06 -05:00
Wolfgang Walther and Steve Chavez
4b4a622a17
fix non-variadic repeated param in variadic function
2020-10-30 10:06:53 -05:00
steve-chavez
8618ffa5fc
perf: shortcut for proc with no variadic arg
...
Also refactor how rpc params are converted to json
2020-10-29 18:53:24 -05:00
steve-chavez
2798ced9b9
Fix charset=utf-8 appending to binary output
2020-10-29 18:53:24 -05:00
steve-chavez
04eaeec7fc
refactor: reorder PgVersion(95/96)Spec tests
...
* move json ops tests to JsonOperatorSpec
* move phfts operator tests to QuerySpec and RpcSpec
* add custom spec for pre-request header guc tests
2020-10-29 18:53:24 -05:00
Wolfgang Walther and Steve Chavez
302d4e15ad
Allow calling variadic functions with repeated query params or JSON array in body
2020-10-26 17:49:51 -05:00
Wolfgang Walther and Steve Chavez
18cc214c04
refactor moving findProc into ApiRequest to allow parsing parameters differently by proc
2020-10-26 17:49:51 -05:00
Wolfgang Walther and Steve Chavez
06e85357c7
add tests to pass regular arrays properly to RPCs
2020-10-26 17:49:51 -05:00
Wolfgang Walther and Steve Chavez
719c4abba2
Drop support for postgres 9.4
2020-10-15 08:43:28 -05:00
monacoremo and Steve Chavez
e4e84e5714
Upgrade nixpkgs and add Postgres 13 support
2020-10-05 13:47:53 -05:00
Wolfgang Walther and GitHub
8e4687fb53
Return 405 Method not Allowed for GET of volatile RPC instead of 500 ( #1560 )
2020-07-16 16:05:57 -05:00
Wolfgang Walther and GitHub
6b2767d35c
Additionally allow "bearer" instead of only "Bearer" in Authorization… ( #1558 )
2020-07-16 12:09:40 -05:00
Wolfgang Walther and GitHub
343e41c51d
Location header improvements( #1475 )
...
* Create location header only on primary key columns, closes https://github.com/PostgREST/postgrest/issues/1461
* Return location header when pk columns not selected, fixes https://github.com/PostgREST/postgrest/issues/1162
2020-07-08 14:36:40 -05:00
Wolfgang Walther and Steve Chavez
a5bc293372
add test cases for singular minimal
2020-07-03 13:54:39 -05:00
Steve Chavez and GitHub
0f0d617951
Allow http status override through response.status guc ( #1541 )
...
Fixes https://github.com/PostgREST/postgrest/issues/1525
2020-06-05 13:01:36 -05:00
steve-chavez
10c363b588
Remove PUT restriction for all columns/single row
...
Fixes https://github.com/PostgREST/postgrest/issues/1452 .
The single row restriction can be lifted because the
PUT will consider only the first object of the array.
2020-05-02 11:51:32 -05:00
steve-chavez
9a52632024
Fix Content-Profile not working for POST RPC
...
Accept-Profile was applied instead.
Fixes https://github.com/PostgREST/postgrest/issues/1508 .
2020-05-02 11:51:32 -05:00
Robert Vollmert and Steve Chavez
5838214910
Fix tests for explicit errors in aeson-1.4.7, and raise lower bound
2020-04-16 17:47:52 -05:00