steve-chavez
8d3c9f8435
refactor: move media type logic to Plan module
2023-09-12 19:24:26 -03:00
steve-chavez
d8a91453d1
fix: inconsistent Preference-Applied
...
* Don't apply `tx=commit` if the transaction doesn't commit
* Apply `count=exact`
* Also simplifies the Preference-Applied logic, removing the need for
some functions.
2023-09-12 13:52:49 -03:00
steve-chavez
0fce7ca361
refactor: Response rm Paths_postgrest dependency
...
This allows using doctests on the Response.hs module
2023-08-02 16:28:48 -05:00
steve-chavez
8d1961ce07
refactor: cache the isolation level
2023-06-06 14:41:37 -05:00
steve-chavez
9a19dff83e
refactor: move debounceLogAcquisitionTimeout
...
Move it to AppState
2023-06-06 14:41:37 -05:00
Steve Chavez and GitHub
a852b766eb
Fix dropping schema cache reload notifications
...
* test: bad schema reload
* refactor: DRY using the "extra" lib
* refactor: move worker funtions inside AppState
* Also rename Workers.hs to Admin.hs
2023-06-02 12:22:17 -05:00
steve-chavez
aaf77902f6
feat: isolation level for roles/functions
2023-04-15 18:05:04 -05:00
Steve Chavez and GitHub
acf62320ef
RPC returning table alias now works for pg 11/12 ( #2737 )
...
The new LATERAL query used for calling the function, introduced on
https://github.com/PostgREST/postgrest/pull/2677 , failed on functions
that returned a domain like `CREATE DOMAIN projects_domain AS projects`.
Work around that by changing the query conditionally, by
obtaining a bool that represents the composite alias on the SchemaCache
and only do this on pg 11 and 12.
2023-04-05 15:34:41 -05:00
Steve Chavez and GitHub
666114f81d
refactor: remove SchemaCache from ApiRequest ( #2695 )
2023-03-06 13:22:35 -05:00
Steve Chavez and GitHub
3e99995e6a
feat: make db-root-spec stable ( #2694 )
2023-03-01 12:23:19 -05:00
steve-chavez
ee036f8397
feat: add server-trace-header config for tracing
2023-02-28 17:30:54 -05:00
Robert Vollmert
9e0ea113fb
refactor: split pre-request function out of setPgLocals
2023-02-27 15:12:32 +01:00
Steve Chavez and GitHub
6a79de67ce
fix: log to stderr on AcquisitionTimeoutUsageError ( #2667 )
...
* refactor: remove uneeded type on checkIsFatal
* dry with a logPgrstError function
2023-02-17 17:38:31 -05:00
steve-chavez
7aadaa44e8
refactor: remove Target from infoResponse
2023-01-30 00:23:24 -05:00
steve-chavez
0139cd8261
refactor: move txMode to Plan
2023-01-30 00:23:24 -05:00
Steve Chavez and GitHub
0fbb116dd2
add basic ARCHITECTURE.md ( #2503 )
...
* refactor: move ApiRequest a top-level module
* refactor: rename DbStructure to SchemaCache
* refactor: GucHeader inside Response
* refactor: admin app to Workers
2022-10-10 11:24:45 -05:00
steve-chavez
e4b98d51be
fix: resource embedding opens empty transaction
...
This required untangling logic from App.hs.
Building/rejecting a plan no longer consumes a pool connection.
* Added io test for failed resource embedding not consuming connection
* optionalrollback to Query.hs and Response.hs
* delete Middleware module
* remove plan logic from App.hs
* remove RequestContext
* remove pkCols logic from App.hs
* remove proc logic from App.hs
* remove config logic from handleRequest
2022-10-07 18:52:57 -05:00
steve-chavez
d37e14c4db
refactor: readTotal into ResultSet
2022-10-07 18:52:57 -05:00
steve-chavez
6398dd2b32
refactor: add plan module
...
* rename/add plan dirs
* add read plan func/data
* add call plan func/data
* add mutate plan func/data
2022-10-04 16:13:34 -05:00
steve-chavez
11385bbd9f
refactor: move binaryField to ApiRequest
2022-10-01 11:05:49 -05:00
steve-chavez
858e4405ec
refactor: getSchema in ApiRequest
2022-10-01 11:05:49 -05:00
steve-chavez
fd67c8480c
refactor: OpenAPI as Response submodule
...
* body after dbstructure
* rename runPgLocals to setPgLocals
2022-10-01 11:05:49 -05:00
steve-chavez
f54dc2e20e
refactor: runPgLocals to Query.hs
...
* unmmiddleware runPgLocals
2022-09-26 17:28:08 -05:00
steve-chavez
e356783cc9
refactor: add Query.hs module
...
* add readQuery
* add createQuery
* update query
* single upsert query
* delete query
* invoke query
* open api query
2022-09-26 17:28:08 -05:00
steve-chavez
b5080fa2d7
refactor: untangle query logic from request logic
2022-09-26 17:28:08 -05:00
steve-chavez
8d369a2195
refactor: add Response.hs module
...
* add response updateResponse
* add singleUpsertResponse
* add delete/invoke response
* add open api response
* add info response
* remove ApiRequest from profileHeader
* contentTypeHeaders only needs ApiRequest
2022-09-25 13:53:11 -05:00
steve-chavez
92e28bd902
refactor: untangle query logic from response logic
...
* untangle failNotSingular
* untangle failsChangesOffLimits
* untangle readTotal
2022-09-25 13:53:11 -05:00
steve-chavez
c27e7be028
refactor: move guc headers/status decoding to App
2022-09-25 13:53:11 -05:00
Laurence Isla and GitHub
d5e662567b
fix: add error body when Prefer: count=exact is used and offset is out of bounds
...
* Adds error body when Prefer: count=exact is used and offset is out of bounds
* Adds details to differentiate between negative limits, lower boundaries greater than upper boundaries and out of bound ranges
2022-09-15 18:39:37 -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
Robert Vollmert
c5849ecbe0
misc: comment typo fix
2022-08-03 19:02:33 +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
steve-chavez
fd7c23f7a1
Add "for" param for the vnd.pgrst.plan media type
2022-08-01 17:41:23 -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
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
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
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
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
Franz-Josef Färber and Steve Chavez
5a3fbd7111
Allow returning XML from single-column queries
2022-05-04 10:27:28 -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
Franz-Josef Färber and Steve Chavez
d2aa50be52
Allow returning XML from RPCs
2022-04-26 17:37:59 -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