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
Robert Vollmert and Steve Chavez
79399686db
Remove unused imports (with newer protolude)
...
The changes here are from fixing stack build with LTS 15.8 (GHC 8.8.3)
to be warning-free. Most if not all come from the newer protolude
version, which adds some things like `unwords`.
So to make sure that we don't get unused import warnings with newer
stackage, this both raises the protolude lower bound and removes
these imports.
2020-04-16 11:10:24 -05:00
Wolfgang Walther and GitHub
be674eb41d
Fix POST, PATCH, DELETE with ?select= and empty body or return=minimal ( #1471 )
...
* add tests for POST, PATCH, DELETE when using ?select= with empty bodies or ret=min
* fix select with empty bodies and ret=min
* improved tests for default cases, fixed computed overloaded columns on empty-body?select= PATCH
2020-04-13 12:32:35 -05:00
Wolfgang Walther and GitHub
c524531784
Fix overloaded computed columns on RPC ( #1473 )
...
* fix some typos and spelling
* fix pg_source CTE name should be prefixed with pgrst_
* added tests for overloaded computed columns on patch calls
2020-04-06 14:04:55 -05:00
691bb5640d
Allow multiple schemas to be exposed in one instance ( #1450 )
...
The schema to use can be selected through the headers `Accept-Profile` for GET/HEAD and `Content-Profile` for POST/PATCH/PUT/DELETE.
This is based on the https://www.w3.org/TR/dx-prof-conneg/ttps://www.w3.org/TR/dx-prof-conneg/ spec.
Also increase all memory tests by 1M(otherwise CI fails).
Co-authored-by: Mahmoud Kassem <MKassem@gk-software.com >
Co-authored-by: Mahmoud Kassem <mahmoud_k@mail.com >
2020-03-30 14:04:20 -05:00
Steve Chavez and GitHub
0f8838623b
Fix empty headers being added on POST/PATCH/DELETE ( #1458 )
2020-03-13 11:02:38 -05:00
Robert Vollmert and Steve Chavez
dfdf3d30b3
Fix test typo.
2020-03-07 13:04:17 -05:00
Robert Vollmert and Steve Chavez
60b64d3e81
Upgrade hspec-wai dependency to 0.10.
2020-03-07 13:04:17 -05:00
steve-chavez
9b1224827a
Allow overriding headers Location,Content-Type,etc
2020-01-21 12:28:05 -05:00
steve-chavez
c7f78fa7fc
Add response.headers on GET/POST/PATCH/PUT/DELETE
2020-01-21 12:28:05 -05:00
steve-chavez
7dade7f466
Add request method and path GUCs
2020-01-21 12:28:05 -05:00
steve-chavez
b20e1150a5
Add GUC for accessing the Authorization header
2020-01-21 12:28:05 -05:00
Steve Chavez and GitHub
663faa1f82
Allow specifying the constraint name to disambiguate an embedding ( #1430 )
...
Makes previous duck typing regex unnecessary since the FK can be renamed
to a singular name or to any other format.
* Remove embedding with duck typed column names
* Allow embedding by foreign key name
* Add junction disambiguation tests
2020-01-06 09:42:33 -05:00