steve-chavez
823348a72a
refactor: configDbPreRequest to QualifiedIdentifier
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
steve-chavez
082c91c855
refactor: remove pgVersion from DbStructure
...
Also use a dedicated MVar for listener
2021-04-30 10:06:07 -05:00
steve-chavez
0f6a13191c
refactor: remove colFK from Column
2021-04-30 10:06:07 -05:00
Remo Rechkemmer and GitHub
6670a3214b
refactor: Move accept content type code from App into ApiRequest ( #1830 )
2021-04-25 21:58:03 +02:00
monacoremo
63e0292e23
fix: Panic when attempting to run with unix socket on non-unix host
2021-04-24 19:42:58 +02:00
monacoremo
59f0fe5b32
fix: Properly close unix domain socket on exit
2021-04-24 19:42:58 +02:00
monacoremo
387c387073
fix: Improve log message on config load
2021-04-24 19:42:58 +02:00
monacoremo
acd787a5af
refactor: Split main/Main.hs into library modules
2021-04-24 19:42:58 +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
steve-chavez
21d280497b
refactor: Relation to Relationship
...
Also remove the unused UnknownRelationship error.
2021-04-21 10:28:20 -05:00
Steve Chavez and GitHub
698bfe6e7b
refactor: make Junction non-recursive ( #1818 )
...
Also Cardinality now includes a Junction or ConstraintName
2021-04-16 13:12:58 -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
c2c7bbe9dd
refactor: remove obsoleted Private module ( #1811 )
2021-04-12 20:47:22 +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
Remo Rechkemmer and GitHub
8c44410ce0
remove misleadingly named emptyOnFalse and similar ( #1803 )
2021-04-11 10:38:35 +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
Remo Rechkemmer and GitHub
65e7f9e846
nix: Add a tool for checking Haskell imports and exports ( #1768 )
2021-04-06 11:46:12 +02:00
steve-chavez
d3a8b5f6e1
Change db-load-guc-config to db-config
...
Make clear that in-db config is being read
2021-03-05 19:03:15 -05:00
steve-chavez
498e77215a
Reread in-db config when recoverying connection
...
* Separate reading files from whole config re-read
* Only reload external file on SIGUSR2/NOTIFY
2021-03-05 19:03:15 -05:00
steve-chavez
6750a5c44d
Restrict db settings to current db and global
...
Global settings are overriden by database specific settings if they
share common ones.
2021-03-05 19:03:15 -05:00
steve-chavez
e4516ab606
Correct db settings to use "_" instead of "-"
...
GUC settings with dashes cannot be shown with show or current_setting.
https://www.postgresql.org/message-id/flat/20210209144059.GA21360%40depesz.com
2021-03-05 19:03:15 -05:00
Remo Rechkemmer and GitHub
e6973f966b
refactor: App.hs and related changes ( #1725 )
...
* Use ExceptT to avoid 'staircasing' case analysis in App.hs
* Split large function in App.hs into individual handler functions
* Adapt API of Auth.hs, OpenApi.hs etc. to simplify the use of those modules in App.hs
* Split optional rollback functionality into Middleware
* Unify SimpleError and ApiRequestError into one Error type, so it can be used across modules
2021-02-23 22:41:48 +01:00
Steve Chavez and GitHub
c93e8f9e0c
Correct hardcoded postgrest_test_authenticator ( #1743 )
...
Also remove panic from Config and correct io test not running
2021-01-25 18:38:46 -05:00
steve-chavez
6557f1f9c0
correct NOTIFY config reload dying on error
2021-01-22 15:56:08 -05:00
steve-chavez
17af56adb1
refactor: config validation inside readAppConfig
...
Remove Either from configJwtRoleClaimKey/configServerUnixSocketMode
and remove whenLefts.
2021-01-22 15:56:08 -05:00
steve-chavez
4344cc9202
refactor: use optString and move overrideFrom
2021-01-22 15:56:08 -05:00
steve-chavez
9c005fc683
feat: get configuration parameters from the db
...
Allows configuring postgrest from the db by setting config parameters
on the connection role. For example:
ALTER ROLE postgrest_test_authenticator
SET pgrst.jwt-secret = "REALLYREALLYREALLYREALLYVERYSAFE"
The above wWill set the `jwt-secret` config option accordingly.
SUPERUSER privileges are required for ALTERing role settings,
so this might not work on some cloud-managed databases.
This feature is enabled by default, for disabling it you can add the
following to the config file:
db-load-guc-config = false
2021-01-19 13:49:40 -05:00
steve-chavez
15039553db
Correct openapi preparing statements by default
2021-01-19 13:49:40 -05:00
Wolfgang Walther and Wolfgang Walther
ba86b479f8
cov: refactor ApiRequest profile header detection
2021-01-14 16:40:29 +01:00
Wolfgang Walther and Wolfgang Walther
6dd126461e
cov: Remove unused code
2021-01-14 16:40:29 +01:00
Wolfgang Walther and Wolfgang Walther
522308217a
refactor: Combine relConstraint and relJunction in relLink
2021-01-03 17:54:28 +01:00
Wolfgang Walther and Wolfgang Walther
d173b7d8d6
cov: remove unused fields from type Column
2021-01-03 17:54:28 +01:00
Wolfgang Walther and Wolfgang Walther
b8e6450af1
refactor: simplify addXRels
2021-01-03 17:54:28 +01:00
Wolfgang Walther and Wolfgang Walther
6efa304142
refactor: Move parseArg to SQL
2021-01-03 17:54:28 +01:00
Wolfgang Walther and Wolfgang Walther
eed6015e70
refactor: Move addHasVariadic to SQL
2021-01-03 17:54:28 +01:00
Wolfgang Walther
cc54135bf0
Rename master branch to main; replace whiteList with isAllowed
2020-12-31 14:37:52 +01:00
Wolfgang Walther and Wolfgang Walther
2cbe1ba903
feat: Add --example cli option to show example config file
2020-12-23 19:39:40 +01:00
Wolfgang Walther and Wolfgang Walther
b7fc393e49
feat: Read config directly from environment variables
...
resolves #1624
2020-12-23 19:39:40 +01:00
Remo Rechkemmer and GitHub
bf141ca13f
feat: Added --dump-schema CLI option to dump JSON of dbStructure schema cache.
...
Added postgrest-dump-schema to nix-shell returning a YAML dump of the test fixtures.
Authored-by: monacoremo <monacoremo>
2020-12-20 10:22:52 +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
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