"_" was used for all the internal json_agg aliases. Now an alias
with "_" plus a local table name is used.
Co-authored-by: Cole Arendt <cole.arendt@outlook.com>
This is enabled by adding `!inner` to the embedded resource
/projects?select=*,clients!inner(*)&clients.id=eq.12
This behaviour can be enabled by default with the config option
db-embed-default-join='inner'
Which saves the need for specifying `!inner` on every request.
If this is enabled, the previous behavior can be restored
per request by specifying `!left` on the embedded resource.
/projects?select=*,clients!left(*)&clients.id=eq.12`
Tested on M20/02M/M2M relationships, views, RPC.
For POST on RPC, allows:
* passing a json object without using `Prefer: params=single-object`
The function must be defined with a single unnamed json param and
`Content-Type: application/json` must be specified.
* uploading binary to a function
The function must be defined with a single unnamed bytea param and
`Content-Type: application/octet-stream` must be specified.
* uploading raw text to a function
The function must be defined with a single unnamed text param and
`Content-Type: text/plain` must be specified.
BREAKING CHANGE If there's a function "my_func" having a single
unnamed json param and other overloaded pairs(with any number of
params), PostgREST won't be able to resolve a POST request to
"my_func". For solving this, you can name the unnamed json param.
my_func(json) -> my_func(prm json)
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.
* 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
* 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.
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.
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.
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
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.
- 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.
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.
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.
* 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
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.
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.