steve-chavez
caaa34b5de
refactor: add CallQuery type
...
Shortens requestToCallProcQuery, which should generate SQL in a more
direct way.
2021-08-30 18:17:59 -05:00
steve-chavez
c9a60373f6
refactor: PgArg to ProcParam
...
Clarify the difference between arguments and parameters.
Parameters are part of the function definition, arguments are the values
passed to the function.
Also clarify the findProc function comments and error message.
2021-08-30 18:17:59 -05:00
steve-chavez
0bc7c034cf
Bump to version v8.0.0
2021-07-25 23:12:51 -05:00
steve-chavez
cbe0e5254e
Reorganize the CHANGELOG
...
* Removed some entries that were fixes for the nigthly versions, not
stable versions.
* Reference the actual issue number(not the PR number) on some entries
* Remove duplicate entries
* Clarify some entries
* Grouped CLI entries
2021-07-25 23:12:51 -05:00
steve-chavez
0961a587c0
Correct openapi ignore-privs table comments
2021-07-06 11:19:54 -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
steve-chavez
1759c1c75b
Update CirrusCI encrypted var
2021-06-22 20:10:43 -05:00
Steve Chavez and GitHub
2944cf94c7
feat: Add time to startup/worker logs ( #1872 )
...
BREAKING CHANGE
Sends startup/worker logs to stderr to differentiate them from
access logs, which go to stdout
2021-06-19 15:55:18 -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
steve-chavez
823348a72a
refactor: configDbPreRequest to QualifiedIdentifier
2021-05-30 16:48:08 -05:00
steve-chavez
5c75f0dcc2
Update BACKERS.md
...
Correct wrong link
2021-05-16 14:32:51 -05:00
steve-chavez
601c802f23
Update BACKERS.md
2021-05-16 14:23:10 -05: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
steve-chavez
6e0ef95320
Add GNUHost as a sponsor
2021-04-23 14:29:33 -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
steve-chavez
9c79a4174c
Add Contributor Covenant Code of Conduct v2
2021-04-06 22:22:13 -05:00
steve-chavez
71f6061d30
Add Supabase as a sponsor
2021-03-25 20:42:43 -05: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
steve-chavez
b50b67491d
Update CYBERTEC logo and BACKERS
2021-02-25 20:03:38 -05: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
125ea8f6d9
feat: allow reloading config with NOTIFY
...
Enables reloading the config by doing:
NOTIFY pgrst, 'reload config'
Adds an alias for reloading the schema cache:
NOTIFY pgrst, 'reload schema'
2021-01-19 13:49:40 -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
674615041a
Correct --dump-schema swallowing error
...
When there's no connection to pg, the following error happens
when running --dump-schema:
postgrest: user error (Pattern match failure in do expression at
main/Main.hs:361:5-14)
Now it shows a regular "could not connect to server.." error.
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
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
steve-chavez
9adec12a67
cirrusci: add build timeout
2020-11-23 19:00:50 -05: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
steve-chavez
65968b5320
circleci: fix nightly release
...
Also delete unused variable in release/default.nix
2020-11-13 14:12:28 -05:00
steve-chavez
ed8bf8272f
Update BACKERS.md
2020-11-13 14:01:58 -05:00
steve-chavez
3830887577
ci: add nightly version to cabal file
2020-11-10 22:47:58 -05:00
steve-chavez
b6d8d89b32
ci: add git sha with hours/minutes to nightly
2020-11-10 22:47:58 -05:00
steve-chavez
814da058ec
cirrusci: add nightly release
2020-11-10 22:47:58 -05:00
steve-chavez
5d140f6fa0
circleci: add nightly release
...
For github and dockerhub
2020-11-10 22:47:58 -05:00
steve-chavez
51b43f5605
nix: change release scripts to use a version arg
2020-11-10 22:47:58 -05:00
steve-chavez
8fd9a9ab5d
travisci: add nightly release
2020-11-10 22:47:58 -05:00
steve-chavez
5f3b581562
appveyor: add nightly release
2020-11-10 22:47:58 -05:00
steve-chavez
139f9b987a
nix: fix postgrest-release-dockerhubdescription
2020-11-10 22:47:58 -05:00
steve-chavez
63849f1275
circleci: make release job a machine
...
setup_remote_docker is somehow not working and gives:
docker: command not found
2020-11-10 22:47:58 -05:00
steve-chavez
9f8d1af2cd
nix: add postgrest-docker-login wrapper func
2020-11-10 22:47:58 -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
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
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
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
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
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
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
24064f8626
github: CHANGELOG reminder in PR template
2020-06-05 13:57:47 -05:00
steve-chavez
8588a42aa9
Fix broken links in .github dir
...
Also add a PR template
2020-06-05 13:40:03 -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
d4aba5cb08
Add notice about single Linux static executable
2020-05-22 14:30:23 -05:00
Steve Chavez and GitHub
67344c8e0a
cabal: fix upload to hackage ( #1532 )
...
When doing:
```
cabal upload dist-newstyle/sdist/postgrest-7.0.1.tar.gz
```
The following error is shown:
```
Error: Invalid package
'ghc-options: -Wall -Werror' makes the package very easy to break with
future GHC versions because new GHC versions often add new warnings.
Use just 'ghc-options: -Wall' instead. Alternatively, if you want to
use this, make it conditional based on a Cabal configuration flag
(with 'manual: True' and 'default: False') and enable that flag
during development.
```
Put -Werror in a cabal flag to work around this restriction.
2020-05-19 13:59:33 -05:00
steve-chavez
222a53015e
Fix Dockerfile
...
Remove libpq5 dependency since static bin already contains it.
2020-05-18 16:50:53 -05:00
steve-chavez
d6050c8615
Bump to version v7.0.1
2020-05-18 13:05:09 -05:00
steve-chavez
7ffac522e3
circleci: remove linux distro releases
...
Prefer the linux static binary for x64
2020-05-18 13:05:09 -05:00
steve-chavez
6c4208d9e7
cirrusci: add binary artifact
2020-05-18 13:05:09 -05:00
steve-chavez
98bf4d861d
circleci: add static bin to release
2020-05-18 13:05:09 -05:00
steve-chavez
6fae07241f
Add FreeBSD CI
2020-05-08 15:11:44 -05:00
steve-chavez
a4f687fdfd
appveyor: specify windows image
2020-05-08 15:11:44 -05:00
steve-chavez
b1a101c253
Update BACKERS.md
2020-05-04 12:17:52 -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
steve-chavez
052843ac9b
Update BACKERS.md
2020-04-13 12:13:35 -05:00
steve-chavez
2b61a63686
Bump to version v7.0.0
2020-04-03 11:22:11 -05:00
steve-chavez
18e45659ea
Fix compiling on windows(unix socket issue)
...
Group unix socket functionality into its own module
2020-04-03 11:22:11 -05:00
steve-chavez
426637a47c
Fix circleci golang docker image
...
Upgrade golang otherwise ghr throws:
unrecognized import path "math/bits"
2020-04-03 11:22:11 -05:00
Steve Chavez and GitHub
ababf7d4fa
Change docker image to support scram-sha-256 auth ( #1467 )
...
Debian stretch has a libpq < 10: https://packages.debian.org/stretch/libpq5 .
But buster has libpq >= 10 https://packages.debian.org/buster/libpq5 .
Fixes https://github.com/PostgREST/postgrest/issues/1443 .
2020-04-01 10:14:00 -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
steve-chavez
de218e900b
Fix for sylish-haskell
2020-02-21 13:30:30 -05:00
steve-chavez
b75e7cef90
Change server-proxy-uri 2 openapi-server-proxy-uri
...
The server-proxy-uri config option mislead into thinking it was a
web server global setting when it's only related to OpenAPI.
2020-02-02 15:23:32 -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