Wolfgang Walther and Wolfgang Walther
eb46cf2662
added: cli option --dump-config prints loaded config and exits
...
This is most useful for automated tests for upcoming configuration
features. Can also be used for debugging.
2020-12-06 13:33:25 +01:00
Wolfgang Walther and Wolfgang Walther
d218a9eaff
dev: improve postgrest-watch experience
...
* speed up io tests
* avoid infinite loop while watching io tests
* improve auto-complete with postgrest-watch postgrest-run
* detect when files are added or deleted
2020-12-05 16:47:50 +01:00
Wolfgang Walther and Wolfgang Walther
7d6d015822
improve error output for io-tests and with_tmp_db
2020-12-03 22:32:07 +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
Wolfgang Walther and Wolfgang Walther
de5742fc7d
Make nix the one and only dev environment; remove obsolete tooling
2020-12-01 00:42:21 +01:00
Wolfgang Walther and GitHub
f2cb91740e
Use cabal v2-exec to run io tests, include io tests in nix-shell by default; remove obsolete ncat dependency ( #1673 )
...
Use cabal v2-exec to run io tests, include io tests in nix-shell by default; remove obsolete ncat dependency
2020-12-01 00:37:45 +01:00
steve-chavez
787973f323
Add db-prepared-statements config
2020-11-23 19:00:50 -05: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
steve-chavez
8e58b56d5c
refactor: Use hasql-dynamic on RPC/POST/PUT/PATCH
...
Change callProc/createWriteStatement to H.Snippet.
Parametrize the inputs on the same SQLFragments by taking advantage
of hasql-dynamic-statements. It's not necessary to parametrize
every input, inlining with pgFmtLit can still be used for queries
that can't be parametrized(like SET LOCALs).
Also adds hasql-dynamic-statements to Nix and stack.
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
698fac8ff2
Add test to ignore functions unnamed arguments for rpc disambiguation, resolves #1638
2020-11-22 14:48:48 -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
d91f47e582
Remove executable bit on .nix and .sql file
2020-11-20 10:48:47 -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
eed0d3a66c
ci: add coveralls.io integration
2020-10-22 12:05:25 -05:00
steve-chavez
d1d0c6772a
perf: change Text queries to ByteString
...
Improves performance by not utf8 encoding the whole query with
encodeUtf8. Only certain parts.
It's also a gradual step needed to use the Snippet type
from hasql-dynamic-statements.
2020-10-17 15:01:06 -05:00
Wolfgang Walther and Steve Chavez
719c4abba2
Drop support for postgres 9.4
2020-10-15 08:43:28 -05:00
steve-chavez
e9efcc70a5
Add log-level config
2020-10-06 14:21:46 -05:00
Remo Rechkemmer and Steve Chavez
741f017a17
Use Postgres 13 in tests/docker-compose.yml
2020-10-05 13:47:53 -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
Steve Chavez and GitHub
189847927e
Schema cache reload with zero downtime ( #1559 )
...
* Improve error messages and comments
* Reorder Main.hs functions
2020-07-16 13:39:25 -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
steve-chavez
e8b4e3771c
Allow config file reloading with SIGUSR2
...
* move config validation to Config.hs
* Add tests for jwt-secret/app.settings.*/db-schema reload
2020-07-13 11:30:16 -05:00
steve-chavez
e272ea47be
refactor: move logStdout/corsPolicy to Middleware
...
* remove configQuiet from Config
configQuiet was not an end user setting.
The logging setup is now an internal parameter.
* move proxy uri validation to Private dir
2020-07-13 11:30:16 -05:00
steve-chavez
0ff05edd16
refactor: move parseSecret out of App.postgrest
...
parseSecret only needs to be computed once, after the config is read.
2020-07-13 11:30:16 -05:00
steve-chavez
896b79f05b
refactor: separate reading file from parsing it
2020-07-13 11:30:16 -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
43d71e95ac
Allow schema cache reloading with NOTIFY ( #1542 )
...
Fixes https://github.com/PostgREST/postgrest/issues/1512
Helps on environments where you can't send unix signals(Windows, managed
containers). Also provides better UX for schema reloads - NOTIFY
can be sent from pg clients(psql, pgadmin).
`NOTIFY pgrst` - with no payload - should be done to reload the schema cache.
Notifications with a payload will be ignored.
The channel can be enabled with `db-channel-enabled`(false by default)
and its name can be configured with `db-channel`.
The LISTEN thread uses a dedicated pg connection.
This connection is recovered if it fails.
A debounce of 1ms is done in case too many NOTIFYs arrive.
2020-06-24 19:00:02 -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
Remo Rechkemmer and GitHub
69b09e312a
Nixify io and memory tests ( #1538 )
...
* Include tests for io and memory in the Nix environment.
* include spec tests in nix-shell by default
* install the io and memory tests in CI
2020-05-28 12:45:14 -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
Remo and GitHub
8b41b71db7
More consistent loading of the test fixtures ( #1506 )
...
Remove db setup from the Haskell test suite and include it in the test bash scripts.
2020-04-29 12:22:15 -05:00
Robert Vollmert and Steve Chavez
3da5a2875e
Update to protolude 0.3.0
...
The good part is that protolude 0.3.0 builds with GHC 8.10.
The bad part is that this change is a bit painful:
- the default `toS` has changed to no longer convert to and from ByteString
- similarly, `show` no longer outputs ByteString
The changes here are pretty much minimal to keep things compiling; I didn't
see a nice way to work with the new ConvertText class, even though `toUtf8`
seems like it might help if used besides `toS` at just the right spots.
2020-04-23 14:14:21 -05:00