steve-chavez
c45e85c5a6
feat: add one to one relationship for embedding
...
BREAKING CHANGE: For the cases where one to one relationships are
detected, json objects will be returned instead of json arrays of length
1.
If you wish to override this behavior, you can use computed
relationships to return arrays again.
2022-08-18 22:36:47 -05:00
steve-chavez
36c24d9cbe
refactor: clean allM2ORels query
...
* remove unnecessary lateral usage
* use alias for pg_constraint
2022-08-18 15:08:14 -05:00
steve-chavez
d6ec171bcb
feat: add computed relationships
...
* work for select, mutations, rpc
* overrides detected relationships
2022-08-17 22:50:06 -05:00
steve-chavez
06c9e246f4
refactor: simplify addJoinConditions
...
* remove unnecessary Either
* remove implicitJoins from ReadQuery
* remove unnecessary foldr in addJoinConditions
* move aliasing to addRels
2022-08-17 22:50:06 -05:00
Laurence Isla and GitHub
b2b92e75cc
Make text the default format for the execution plan
2022-08-17 17:58:02 -05:00
Gabriel and GitHub
506929c586
fix: Make views pk and fk schema query compatible with postgres v15
2022-08-17 14:20:34 -05:00
Laurence Isla and GitHub
7de8d5446a
Revert bulk update patch
...
- Revert patch #2311
- Keep the refactor done to qsFiltersRoot
- Keep the refactor done to the items tables
- Add tests that now work with pg-safeupdate as a result
2022-08-12 10:00:33 -05:00
steve-chavez
3648986aa8
refactor: correlated subquery for o2m query
...
Improves the query costs a bit as shown in the tests and reduces code.
2022-08-06 21:42:53 -05:00
Robert Vollmert
92d00749a3
refactor: move pool release on shutdown out of signal handler
...
This changes behaviour somewhat in that:
- We now consistently release the pool on shutdown, even on non-Unix
platforms, and including for CmdDumpConfig.
- We release the pool *after* interrupting `App.run`, which will
rather cause more than fewer connection to be closed properly.
(Previously any in-use connections would not have been caught by
`releasePool`, though *maybe* the `UserInterrupt` handling in
the web handler ends up closing the connections properly already
anyway).
(The main aim of the change is to make it clearer when and why the
pool is released.)
2022-08-03 19:02:33 +02:00
Robert Vollmert
c5849ecbe0
misc: comment typo fix
2022-08-03 19:02:33 +02:00
Robert Vollmert
c8739aa8a3
fix: fix some race conditions running connection worker
...
Previously, it was quite possible to have two connection workers
running, or to get into a state where a failed connection worker
is still considered running preventing new connection workers
from starting.
2022-08-02 09:51:19 +02:00
Robert Vollmert
d4950c6460
refactor: drop getPool
2022-08-02 09:24:14 +02:00
Robert Vollmert
1d15060c63
refactor: AppState.usePool for App
...
This is a bit ugly, it would be a bit nicer to just pass
'AppState.usePool appState' but then the types get messy.
Or we could introduce our own 'Pool' wrapper type.
2022-08-02 09:24:14 +02:00
Robert Vollmert
401b98c5b4
refactor: introduce AppState.usePool
2022-08-02 09:24:14 +02:00
Robert Vollmert
d53949e4a4
refactor: queryDbSettings doesn't need the pool
2022-08-02 09:24:14 +02:00
Robert Vollmert
421163dc75
refactor: use AppState.releasePool everywhere
...
This prepares for wrapping the pool in a reference.
2022-08-02 09:24:14 +02:00
Robert Vollmert
eae169ca67
refactor: move interrupt out of releasePool helper
2022-08-02 09:24:14 +02:00
Robert Vollmert
ec23067e3e
refactor: simplify main, address reReadConfig TODO
2022-08-02 09:24:14 +02:00
steve-chavez
fd7c23f7a1
Add "for" param for the vnd.pgrst.plan media type
2022-08-01 17:41:23 -05:00
steve-chavez
84e03a16dd
fix: columns w/ dollar sign($) don't need quoting
2022-07-30 19:50:09 -05:00
Steve Chavez and GitHub
8911afd079
feat: Allow getting the EXPLAIN plan of a request
2022-07-27 19:33:34 -05:00
steve-chavez
2eb7c803e3
feat: support OPTIONS on RPC and root path
2022-07-17 18:40:14 -05:00
steve-chavez
4ab5e63e58
fix: no empty transaction on OPTIONS request
2022-07-17 14:41:51 -05:00
steve-chavez
c445105d55
correct query on rpc count=exact
...
corrects bad logic on e4006da(perf: remove toSourceRel)
2022-07-16 17:18:25 -05:00
Laurence Isla and GitHub
e0ba6b6d1c
Add security definitions to the OpenAPI output
2022-07-13 22:47:09 -05:00
Laurence Isla and GitHub
bdf1cbe111
fix: inaccurate result count when an inner embed is selected after a normal embed in the query string
2022-07-12 22:29:42 -05:00
steve-chavez
8230128ff6
fix: no empty tx on bad HTTP method
2022-07-11 18:21:36 -05:00
steve-chavez
6d7bf9faa9
fix: no empty tx on Not Found error
2022-07-11 18:21:36 -05:00
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
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
Laurence Isla and GitHub
169547aee6
Return Location header only when using Prefer: return=header-only
2022-06-24 12:53:27 -05:00
Laurence Isla and GitHub
f7745e1569
fix: Allow schema names with special characters in the search path
...
Fixes regression where the search path did not recognize schemas with uppercase, spaces and other special characters in their names.
2022-06-23 18:54:43 -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
Robert Vollmert
f582798276
ReadQuery: split out to fix record field warning
...
The use of `where_` in DbRequestBuilder issues a warning since
GHC 9.2 as per
https://github.com/ghc-proposals/ghc-proposals/blob/master/proposals/0366-no-ambiguous-field-access.rst
To disambiguate that, move the type to a separate module and use
the record field names qualified. For symmetry, MutateQuery also
gets its own module.
2022-06-16 10:38:59 +02:00
Robert Vollmert
ba87a60a47
rangeParse: fix incomplete pattern match warning
...
The warning is new in GHC 9.2 compared to 8.10.
2022-06-16 10:37:05 +02: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
Robert Vollmert
36ed7e2fb7
src, nix: hlint update
...
This pulls in an updated hlint version from nixpkgs, and fixes some
new eta-reduction warnings. (I don't particularly think this is more
readable, but I suppose being consistently hlint-clean is worth it.)
2022-06-14 19:13:55 +02:00
Robert Vollmert
2b8ffc8e61
src: update for changed map type in aeson-2
...
This means that we're now using Data.Map.Strict instead of
Data.HashMap.Strict for JSON objects in general, and specifically
for claims maps and CSV rows.
This addresses certain hash flooding vulnerabilities, but may
have performance downsides.
Compare e.g. https://frasertweedale.github.io/blog-fp/posts/2021-10-12-aeson-hash-flooding-protection.html
2022-06-13 13:25:54 +02:00
Robert Vollmert
5e6987b1d8
src: consistently import HashMap as HM, Map as M
...
With both HashMap and Map imported as M in different modules,
linter rules prevented ever importing both modules in one place.
2022-06-13 13:16:50 +02:00
Laurence Isla and GitHub
f9688c3553
Upgrade protolude to 0.3.1
2022-06-08 11:41:39 -05:00
Franz-Josef Färber and Steve Chavez
807364bd7b
RPC POST for function w/single unnamed XML param
2022-06-03 11:52:57 -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
Franz-Josef Färber and Steve Chavez
5a3fbd7111
Allow returning XML from single-column queries
2022-05-04 10:27:28 -05:00
Laurence Isla and GitHub
a2349d90c0
Reorganize error groups
...
* Grouped Hasql errors into one error and renamed it to InternalError
* Move all the General errors to ApiRequest errors
2022-05-02 21:16:31 -05:00
steve-chavez
50b275d3e2
refactor: move PUT checks to ApiRequest
2022-05-02 11:12:02 -05:00