steve-chavez
28183a667c
refactor: rm raw media types unnecessary decoding
...
Just convert them to MTOther instead
2022-07-11 18:21:36 -05:00
Steve Chavez and GitHub
3cdc6d15d7
test: add bulk insert to loadtest ( #2358 )
2022-07-06 13:50:58 -05:00
steve-chavez
0708f46df3
refactor: pass media type to Statements module
2022-07-06 13:47:59 -05:00
steve-chavez
7a7ceaf39a
refactor: rename ContentType to MediaType
...
The core type was wrongly named as the header
2022-07-06 13:47:59 -05:00
steve-chavez
3e83bef9c4
bump version to 9.0.1.20220630
2022-06-30 13:53:33 -05:00
steve-chavez
870f7a39b0
Add PostGIS GeoJSON support
...
Works for GET, POST, PATCH, PUT, DELETE, RPC.
2022-06-22 22:16:44 -05:00
steve-chavez
86c40e8df9
test: don't run spec tests with stack
...
We cannot handle postgis and other postgresql dependencies with
stack.
Also delete test/with_tmp_db since it's no longer used.
2022-06-22 22:16:44 -05:00
steve-chavez
d87b622d64
nix: update tests README
2022-06-20 15:55:22 -05:00
Steve Chavez and GitHub
86574c89a8
Bulk update ( #2311 )
...
* refactor: remove EmbedPath type from qsFiltersRoot
* Rename reset items function for reusability
2022-06-15 20:30:31 -05:00
steve-chavez
df7d71db32
fix: Increase the db-pool-timeout to 1 hour
2022-06-15 13:19:44 -05:00
steve-chavez
d14f745406
bump version to 9.0.0.20220531
2022-05-31 18:19:02 -05:00
steve-chavez
1cdc9169c7
fix: using CPU while idle
2022-05-31 12:17:36 -05:00
steve-chavez
9aa400c8f3
fix: disable parallel GC for perf on high-core CPU
2022-05-31 12:17:36 -05:00
steve-chavez
1ab11de96c
bump version to 9.0.0.20220516
2022-05-16 14:36:04 -05:00
steve-chavez
f7b173163c
fix: ignore views on col/fk as target
...
Also refactor self relationship findRel logic
2022-05-16 12:22:24 -05:00
steve-chavez
2be63b36d6
refactor: self relationship
...
* Add test for self relationship in view
2022-05-09 21:31:19 -05:00
steve-chavez
c60380b5fc
perf: RelationshipsMap with foreign schema as key
2022-05-09 21:31:19 -05:00
steve-chavez
d88b16e5ab
fix: allow cast on types with underscores/numbers
...
e.g. select=oid_array::_int4
2022-05-09 13:02:33 -05:00
steve-chavez
980f27a6d1
bump version to 9.0.0.20220502
2022-05-02 16:06:51 -05:00
steve-chavez
ce96c88ba0
test: increase memory tests memory by 1M
2022-05-02 11:12:02 -05:00
steve-chavez
50b275d3e2
refactor: move PUT checks to ApiRequest
2022-05-02 11:12:02 -05:00
steve-chavez
e90391b7ac
limited update/delete requires explicit order
...
* limited update/delete now works on views with explicit order
* no default order, enforce order presence
* apply row count to ensure limited mutations
* move requiring order to ApiRequest
2022-05-02 11:12:02 -05:00
steve-chavez
115dae7484
perf: Relationship list to a hash map
2022-04-25 21:41:51 -05:00
steve-chavez
e4006da9bc
perf: remove toSourceRel
...
toSourceRel is an expensive operation since it iterates over all the
relationships detected. We now use an alias on the CTE so embedding can
work without toSourceRel.
2022-04-25 21:41:51 -05:00
steve-chavez
a47c59baca
fix: restrict generated m2m relationships
...
Only add m2m relationship based on real junctions:
a table has FKs to two other tables and the FK columns
are part of the PK columns.
Also add some stats to big_schema.sql
2022-04-25 12:35:16 -05:00
steve-chavez
07d619981e
perf: don't lookup Table pkCols unnecessarily
...
handleCreate only needs it on some headers, udpate and delete don't need
pkcols.
2022-04-22 19:04:16 -05:00
steve-chavez
778b8d074d
refactor: merge Column list into Table
...
* Remove Table from Column
* Correct OpenAPI test where the schema was appearing for the enum unnecessarily
* Increase memory-tests consumption by 2M
Seems the Hasql decoder consumes more memory now that the allTables
results also have [Column] inside.
2022-04-22 19:04:16 -05:00
steve-chavez
902e4e8921
refactor: clean allColumns query
...
* Add OpenAPI test to ensure enum labels are present
* Remove unnecessary fk/pk columns cte
* Remove unnecessary step for parsing enum labels
2022-04-22 11:46:45 -05:00
steve-chavez
d2719420f4
refactor: PKcols in table, ViewKeyDependency type
...
* Get PKcols inside tables - done with SQL for tables and
with an additional step in Haskell for views.
This fixes an fk column being considered as a pk column on views
and corrects the test added on
https://github.com/PostgREST/postgrest/pull/1875/files/1d549768580310e18aac4ffa6dbd01c5b77934a7#r853674126
* classify view key dependencies in SQL
* remove Column from Relationship
* Merge cols/fcols in Relationship and
ensure allM2ORels and allViewsKeyDependencies fk columns
are ordered - done by attnum in SQL
* Cardinality now contains relColumns instead of Relationship -
this simplifies getJoinConditions.
2022-04-21 14:44:45 -05:00
steve-chavez
057e8d63bf
test: add big schema openapi test
...
The io test is marked as pending for now, because the stack size it
requires is too big.
2022-04-20 20:05:11 -05:00
steve-chavez
f4e171aa2b
refactor: ignore partitions in allM2ORels
...
Also clarify foreign key filter
2022-04-19 17:23:12 -05:00
steve-chavez
7f1507b9fb
refactor: remove Table from Relationship
...
Just having the QualifiedIdentifier gets us closer to having
Relationship as a Table attribute since it avoids a cyclic dependency
* remove unnecessary findTable
* modify RootSpec test
2022-04-18 15:48:03 -05:00
steve-chavez
cdcc175abf
refactor: table list to table map
2022-04-18 15:48:03 -05:00
steve-chavez
f995799e8f
refactor: remove fkey from allPrimaryKeys query
...
The query had the unnecessary 'f' in `c.contype in ('p', 'u', 'f')`
Also comment and clarify the query by using explicit JOINs
2022-04-18 15:48:03 -05:00
steve-chavez
44e2b2fbb4
refactor: DRY allTables/accessibleTables query
2022-04-18 15:48:03 -05:00
steve-chavez
2eaf81334e
nix: local history for nix-shell
2022-04-18 15:48:03 -05:00
steve-chavez
c399b1f5f8
nix: log all statements in temp db
2022-04-18 15:48:03 -05:00
steve-chavez
f3f9030c48
disallow limit/offset on views
2022-03-26 15:29:13 +01:00
steve-chavez
73dc2692b1
refactor: add findTable function
2022-03-26 15:29:13 +01:00
steve-chavez
87ffe39746
fix: ignore max-rows on POST/PATCH/PUT/DELETE
2022-03-26 15:29:13 +01:00
steve-chavez
331e88ea39
feat: add limited delete
2022-03-26 15:29:13 +01:00
steve-chavez
f4becf99ad
feat: add limited update
2022-03-26 15:29:13 +01:00
Steve Chavez and GitHub
a3c1d9977f
Correct live/ready checks to consider special host values ( #2182 )
2022-03-11 15:16:45 +01:00
steve-chavez
dcf7ade5bc
bump version to 9.0.0.20220211
2022-02-11 14:47:33 -05:00
Steve Chavez and GitHub
9021c96baa
fix: Keep working when EMFILE is reached ( #2158 )
...
Done by upgrading to warp 3.3.19
2022-02-09 17:27:29 -05:00
Steve Chavez and GitHub
c7cadcd776
Fix embedded filter silently getting ignored ( #2133 )
...
When the embedded resource is not included in the request
2022-01-24 17:52:27 -05:00
Steve Chavez and GitHub
65f27653dc
cov: empty coverage overlay ( #2119 )
...
The overlay depended on the version number, which caused errors when upgrading.
Also update cabal description.
2022-01-07 13:06:03 -05:00
steve-chavez
a134d8a493
pre-release: Bump to 9.0.0.20220107
...
Previous pre-release had a wrong date
2022-01-07 11:06:03 -05:00
steve-chavez
3ded567f6d
pre-release: Bump to 9.0.0.20210107
2022-01-07 11:01:59 -05:00
steve-chavez and Wolfgang Walther
51ee072f84
fix: clarify error for failed schema cache load
2022-01-07 09:31:30 +01:00
steve-chavez and Wolfgang Walther
aa82d2e277
Consider schema cache state on the ready check
...
* empty schema cache when it fails loading so the ready check can pick
its new state
2022-01-07 09:31:30 +01:00
steve-chavez
4a9ca9bdae
Add live endpoint to admin server
...
* refactor io tests
* add network package to windows
2022-01-04 20:12:52 -05:00
steve-chavez
65a3ae08f0
Change admin health endpoint to ready
2022-01-04 20:12:52 -05:00
steve-chavez
bba6e96fd3
Connect to main app socket on health check
2022-01-04 20:12:52 -05:00
Steve Chavez and GitHub
ac3655df1d
feat: minimal health check ( #2092 )
2021-12-23 08:00:10 -05:00
Steve Chavez and GitHub
c86e254a24
fix: is not working with upper/mixed case values ( #2081 )
2021-12-14 19:13:38 -05:00
Steve Chavez and GitHub
c9f017c632
Bump to v9 ( #2045 )
...
* Reorganize the CHANGELOG
* Add missing change for dropping support for embedding hints used with '.'
* Move the pg 14 compatibility entry to Added
2021-11-26 14:10:57 -05:00
steve-chavez
132ecd8d74
Correct count query when doing inner joins
2021-11-26 10:39:19 -05:00
steve-chavez
1b48531369
remove the db-embed-default-join config
2021-11-23 12:32:51 -05:00
steve-chavez
bf58a3600a
refactor: remove pgFmtLit
2021-11-18 17:01:58 -05:00
steve-chavez
bae5afbad6
feat: allow unknown on the is operator
...
Also make the IS values strict at the Parser level since IS cannot be
parametrized.
2021-11-18 17:01:58 -05:00
3b83f536ca
Correct inner join to use proper aliases ( #1978 )
...
"_" 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 >
2021-10-18 17:34:31 -05:00
steve-chavez
ee56dd5db1
feat: filter top-level resource with embed filter
...
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.
2021-10-04 13:46:32 -05:00
steve-chavez
bf91187e63
Drop support for embed hints used as '.'
...
Hints used like `select=projects.client_id(*)` were already
deprecated.
'!' should be used from now on `select=projects!client_id(*)`
2021-10-04 13:46:32 -05:00
steve-chavez
885ff60138
pre-release: Bump to v9.0.0-a1
2021-09-14 15:51:32 -05:00
steve-chavez
72a28a145d
feat: Allow backslash escaping inside double quotes
...
Examples:
- ?col=in.("Double\"Quote")
- ?col=in.("Back\\slash")
Backslashed chars get passed as is
- ?col=in.("\a\b\c") = ?col=in.(abc)
2021-09-13 19:06:30 -05:00
steve-chavez
4a594d5e95
fix: using " and \ as values on the in filter
...
Properly escape the array literal built at the QueryBuilder
stage.
2021-09-13 19:06:30 -05:00
steve-chavez
d4c6abbaec
feat: RPC POST for function w/single unnamed param
...
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)
2021-08-30 18:17:59 -05:00
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