Steve Chavez and GitHub
ebd474a7e6
fix: retry connection on failed schema cache load ( #1685 )
...
Retry the connection when the
"Failed to load the schema cache" error happens.
Also die if the schema cache query has a syntax error.
2020-12-09 14:20:00 -05:00
steve-chavez
11d62a8010
Prepared statement for set_config
2020-12-07 20:09:18 -05:00
steve-chavez
7069bb3c01
refactor: Change SET LOCAL gucs to set_config
2020-12-07 20:09:18 -05:00
Wolfgang Walther and Wolfgang Walther
9254f119f6
fix: implement robust parsing of boolean config values
...
resolves #1572
2020-12-06 21:59:32 +01:00
Wolfgang Walther and Wolfgang Walther
ed58511de3
feat: renamed config options with prefixes; added aliases for old names
...
* secret-is-base64 -> jwt-secret-is-base64
* role-claim-key -> jwt-role-claim-key
* max-rows -> db-max-rows
* pre-request -> db-pre-request
* root-spec -> db-root-spec
* db-schema -> db-schemas
This is not a breaking change, because aliases are added as well.
refactor: sorted all config keys alphabetically where applicable
2020-12-06 21:59:03 +01:00
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
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 Wolfgang Walther
b13e95aefb
Refactor tx-... config options to single tx-end option
2020-11-23 22:43:49 +01:00
Wolfgang Walther and Wolfgang Walther
3425352035
Clean up postgrest --help output
2020-11-23 17:40:04 +01: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
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
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
efc725fb24
run stylish-haskell v0.12.1.0
2020-11-02 13:22:01 -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
a6696f3ba1
refactor: add Hasql arrayColumn decoder
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
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
steve-chavez
7e3e19acbb
refactor: untangle addFiltersOrdersRanges
...
Remove convoluted function composition
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
ccad9eb9bc
Change default log-level, from info to error
2020-10-06 14:21:46 -05:00
steve-chavez
d9a608d9b0
Add warn log level
2020-10-06 14:21:46 -05:00
steve-chavez
f6b6abe734
Add error log level
2020-10-06 14:21:46 -05:00
steve-chavez
e9efcc70a5
Add log-level config
2020-10-06 14:21:46 -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 Steve Chavez
d395bb6052
Fix error messages on connection failure for postgres on localized Windows
2020-10-03 10:11:41 -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
96a16a377f
refactor: move loadDbUriFile/SecretFile to Config
...
* make schema cacher filler use Appconfig
* change configRoleClaimKey to Either Text JSPath
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
steve-chavez
55b4f4fbe7
Fix expired JWTs starting an empty transaction
...
Fixes https://github.com/PostgREST/postgrest/issues/1094 .
Expired JWTs were doing an empty BEGIN/COMMIT in the db.
2020-07-03 17:23:10 -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
48c9ac36b1
Bump nixpkgs and simplify/clean up nix setup ( #1529 )
...
* Refactor tests and fix README
* fix linting hints from new hlint version
* postgrest-style with new nixpkgs-fmt
2020-05-20 21:30:20 -05:00
Remo Rechkemmer and GitHub
e6874c866d
Fix UNKNOWN being shown as git commit hash ( #1533 )
...
Fixes https://github.com/PostgREST/postgrest/issues/1530
2020-05-20 14:10:53 -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
steve-chavez
f57caf0987
Readd openapi-server-proxy-uri config option
...
This option accidentaly got lost during a merge.
Fixes https://github.com/PostgREST/postgrest/issues/1500
2020-05-02 11:51:32 -05:00
Remo and GitHub
f02904a959
Simplify the DbStructure queries ( #1478 )
...
* remove unused parts of the DbStructure queries
* explain magic numbers in DbStructure queries
* simplify primary keys query
2020-04-29 13:01:46 -05:00