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
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
Laurence Isla and GitHub
7589102c6c
Fix misleading disambiguation error where relationship looks like valid syntax
...
* Add columns for the m2m relationship
2022-04-12 00:02:19 +02:00
Michael Kane Juncker and Wolfgang Walther
007f49a8bc
feat(query): add basic regular expression operator support - refs #2236
2022-04-11 08:33:16 +02: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
Ezequiel Alvarez and GitHub
799daa7556
fix: json/jsonb columns should not have type "string" in OpenAPI spec ( #2203 )
...
* Switch to no type for json/jsonb
2022-03-26 15:16:35 +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
Laurence Isla and GitHub
d6834e8bf8
Add 'PGRST' error code to differentiate from PostgreSQL errors
2022-03-04 15:57:38 -05:00
Laurence Isla and GitHub
99d0b805df
fix: Using GET with certain Content-Type headers now correctly calls the no parameter function if it exists
...
Using GET with text/plain or application/octet-stream as Content-Type headers no longer returns 404 Not Found when a function with no parameters exists
2022-02-28 13:23:55 -05:00
Laurence Isla and GitHub
69070f341a
fix: Remove admin-server-port from in-db configuration
2022-02-23 17:26:01 -05:00
Wolfgang Walther and Wolfgang Walther
41a4396147
fix: Remove uncallable functions from schema cache and OpenAPI output
...
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-02-08 09:08:27 +01:00
Wolfgang Walther and Wolfgang Walther
d9f7f6f509
refactor: Remove pg_catalog prefix from schema cache queries
...
Since the search path is voided at the beginning, there is no need to qualify those.
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-02-08 09:08:27 +01:00
Wolfgang Walther and Wolfgang Walther
bd62008e1c
fix: Remove aggregates, procedures and window functions from schema cache and OpenAPI output
...
Aggregates and Window functions can't be called as RPCs in a useful way.
Procedures are not supported right now, but might be added later.
Resolves #2101
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-02-05 17:48:22 +01:00
Wolfgang Walther and Wolfgang Walther
ded8981368
fix: Take PG version into account in --dump-schema
...
The PG version is only read by the Connection Worker, which is not used in the case dump-schema. Now, the pg version is read in the schema cache queries directly, avoiding this problem in all cases.
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-02-05 17:48:22 +01:00
Wolfgang Walther and Wolfgang Walther
52d628f1ed
fix: Return 204 No Content without Content-Type for RPCs returning VOID
...
Resolves #2001
BREAKING CHANGE: Previously, those RPCs would return "null" as a body with Content-Type: application/json.
2022-02-05 09:28:28 +01:00
Wolfgang Walther and Wolfgang Walther
9f1b5c0a81
feat: Support accessing array items and fields of composite types through json operators
...
This is supported in select=, in filters and in order=.
Resolves #1543
Resolves #2075
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-02-03 08:13:38 +01:00
Wolfgang Walther and Wolfgang Walther
58f76f3d6d
fix: Return 405 Method Not Allowed for unsupported verbs
...
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-01-28 19:26:33 +01:00
Wolfgang Walther and Wolfgang Walther
8980b09419
refactor: Sort error types
...
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-01-28 19:26:33 +01:00
Wolfgang Walther and Wolfgang Walther
927ff6f1e5
test: Split spec tests into multiple subfolders
...
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-01-28 19:26:33 +01:00
Wolfgang Walther and Wolfgang Walther
8a722e2cfe
refactor: Replace elem with pattern matching to highlight missing code coverage
...
Signed-off-by: Wolfgang Walther <walther@technowledgy.de >
2022-01-28 19:26:33 +01:00
Wolfgang Walther and Wolfgang Walther
fc7113e52e
fix: Remove trigger functions from schema cache and OpenAPI output
...
Trigger functions can't be called directly from SQL and can't be called
via the /rpc prefix either - it makes no sense to expose them in the
OpenAPI output. And we don't need to cache them in the schema cache
either.
Best practice would be to keep the trigger functions in a non-exposed
schema anyway.
2022-01-28 16:45:36 +01: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
Wolfgang Walther and Wolfgang Walther
d2791ea0e5
Sort example config alphabetically
2022-01-24 14:56:06 +01:00
Wolfgang Walther and Wolfgang Walther
f4637c64c9
Remove db-root-spec from example config file
...
We are not going to support this officially right now.
2022-01-24 14:56:06 +01:00
Wolfgang Walther and Wolfgang Walther
1b9a30cff4
Make db-uri, db-schemas and db-anon-role optional in example config file
2022-01-24 14:56:06 +01:00
Wolfgang Walther and Wolfgang Walther
5a627e76b2
format comments in example config consistently
2022-01-24 14:56:06 +01:00
Wolfgang Walther
d9e016be8b
feat: Allow running postgrest without configuration
...
Resolves #1823
2022-01-22 15:59:26 +01:00
Wolfgang Walther
c3ade07ad6
feat: Make db-anon-role optional
...
Without db-anon-role, PostgREST will block any anonymous access without hitting the database.
Resolves #1689 , Ref #1823
2022-01-22 15:59:26 +01:00
Wolfgang Walther
dbbde6aae1
feat: Make db-schemas optional
...
Resolves #1769 , Ref #1823
2022-01-22 15:13:21 +01:00
Wolfgang Walther
9ed30c0ba4
feat: Make db-uri optional
...
The default is now "postgresql://" which falls back to LIBPQ environment variables.
Resolves #1991 , Ref #1823
2022-01-22 15:13:19 +01:00
Wolfgang Walther and Wolfgang Walther
995215c6a5
fix: Read database configuration properly when = is present in value
...
Resolves #2120
2022-01-10 09:24:49 +01:00
Wolfgang Walther and Wolfgang Walther
4b841dba61
refactor: Reformat db-config query
2022-01-10 09:24:49 +01:00
Wolfgang Walther and Wolfgang Walther
9639cd5751
feat: Add current user to apache-style request logging.
2022-01-07 20:26:33 +01:00
3c17f97c87
refactor: Make JWT authorization a middleware
...
This follows the style of wai-middleware-auth package and
makes the JWT parsing a middleware.
Co-authored-by: Wolfgang Walther <walther@technowledgy.de >
2022-01-07 20:26:33 +01:00
Wolfgang Walther and Wolfgang Walther
d97bf3b864
refactor: Move each Wai Middleware to a separate file
2022-01-07 20:26:33 +01:00
Wolfgang Walther
6bc965e2a0
run postgrest-style
2022-01-07 11:39:41 +01:00
monacoremo and Wolfgang Walther
bfbec8fa36
refactor: Carve out QueryParams module
2022-01-07 09:32:33 +01: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
Wolfgang Walther and Wolfgang Walther
e13d912a79
cov: Add coverage overlay for impossible case in corsPolicy
2022-01-05 11:01:54 +01:00