From 35d9b98bff9f177179c7d8911f1c6a80557192f0 Mon Sep 17 00:00:00 2001 From: Laurence Isla Date: Tue, 23 Nov 2021 22:12:29 -0500 Subject: [PATCH] Remove the db-embed-default-join config --- api.rst | 61 +++++++++++++++++++++++++++++++------------ configuration.rst | 16 ------------ releases/upcoming.rst | 8 ++---- 3 files changed, 46 insertions(+), 39 deletions(-) diff --git a/api.rst b/api.rst index a58d4356a..3529b3e19 100644 --- a/api.rst +++ b/api.rst @@ -475,9 +475,15 @@ If the value filtered by the ``in`` operator has a double quote (``"``), you can Here ``Quote:"`` and ``Backslash:\`` are percent-encoded values. Note that ``%5C`` is the percent-encoded backslash. -.. code-block:: http +.. tabs:: - GET /marks?name=in.(%22Quote:%5C%22%22,%22Backslash:%5C%5C%22) HTTP/1.1 + .. code-tab:: http + + GET /marks?name=in.(%22Quote:%5C%22%22,%22Backslash:%5C%5C%22) HTTP/1.1 + + .. code-tab:: bash Curl + + curl "http://localhost:3000/marks?name=in.(%22Quote:%5C%22%22,%22Backslash:%5C%5C%22)" .. note:: @@ -992,9 +998,15 @@ Top Level Filtering By default, embedded filters don't change the top level resource rows at all: -.. code-block:: http +.. tabs:: - GET /films?select=title,actors(first_name,last_name)&actors.first_name=eq.Jehanne HTTP/1.1 + .. code-tab:: http + + GET /films?select=title,actors(first_name,last_name)&actors.first_name=eq.Jehanne HTTP/1.1 + + .. code-tab:: bash Curl + + curl "http://localhost:3000/films?select=title,actors(first_name,last_name)&actors.first_name=eq.Jehanne .. code-block:: json @@ -1020,9 +1032,15 @@ By default, embedded filters don't change the top level resource rows at all: In order to filter the top level rows you need to add ``!inner`` to the embedded resource. For instance, to get **only** the films that have an actor named ``Jehanne``: -.. code-block:: http +.. tabs:: - GET /films?select=title,actors!inner(first_name,last_name)&actors.first_name=eq.Jehanne HTTP/1.1 + .. code-tab:: http + + GET /films?select=title,actors!inner(first_name,last_name)&actors.first_name=eq.Jehanne HTTP/1.1 + + .. code-tab:: bash Curl + + curl "http://localhost:3000/films?select=title,actors!inner(first_name,last_name)&actors.first_name=eq.Jehanne" .. code-block:: json @@ -1038,12 +1056,6 @@ In order to filter the top level rows you need to add ``!inner`` to the embedded } ] -If you prefer to work with top level filtering as a default embedding behavior for PostgREST, set the :ref:`db-embed-default-join` configuration parameter to ``"inner"``. This way, you don't need to specify ``!inner`` on every request and, if you need the previous behavior, add ``!left`` to the embedding resource. For instance, this will not filter the films in any way: - -.. code-block:: http - - GET /films?select=title,actors!left(first_name,last_name)&actors.first_name=eq.Jehanne HTTP/1.1 - .. _embedding_partitioned_tables: Embedding Partitioned Tables @@ -1380,9 +1392,15 @@ Similarly to the **target**, the **hint** can be a **table name**, **foreign key Hints also work alongside ``!inner`` if a top level filtering is needed. From the above example: -.. code-block:: http +.. tabs:: - GET /orders?select=*,central_addresses!billing_address!inner(*)¢ral_addresses.code="AB1000" HTTP/1.1 + .. code-tab:: http + + GET /orders?select=*,central_addresses!billing_address!inner(*)¢ral_addresses.code=AB1000 HTTP/1.1 + + .. code-tab:: bash Curl + + curl "http://localhost:3000/orders?select=*,central_addresses!billing_address!inner(*)¢ral_addresses.code=AB1000" .. _insert_update: @@ -1682,10 +1700,19 @@ To delete rows in a table, use the DELETE verb plus :ref:`h_filter`. For instanc Deletions also support :code:`Prefer: return=representation` plus :ref:`v_filter`. -.. code-block:: HTTP +.. tabs:: - DELETE /user?id=eq.1 HTTP/1.1 - Prefer: return=representation + .. code-tab:: http + + DELETE /user?id=eq.1 HTTP/1.1 + Prefer: return=representation + + .. code-tab:: bash Curl + + curl "http://localhost:3000/user?id=eq.1" -X DELETE \ + -H "Prefer: return=representation" + +.. code-block:: json {"id": 1, "email": "johndoe@email.com"} diff --git a/configuration.rst b/configuration.rst index c3a38301d..2826e2d5d 100644 --- a/configuration.rst +++ b/configuration.rst @@ -50,7 +50,6 @@ db-channel-enabled Boolean True db-prepared-statements Boolean True db-tx-end String commit db-config Boolean True -db-embed-default-join String left db-use-legacy-gucs Boolean True server-host String !4 server-port Int 3000 @@ -201,21 +200,6 @@ db-config Enables the in-database configuration. -.. _db-embed-default-join: - -db-embed-default-join ---------------------- - - Determines the default embedding type between tables or views when none is specified in the request. For more info, see :ref:`embedding_top_level_filter`. - - .. code:: bash - - # Embeds using LEFT JOIN - db-embed-default-join = "left" - - # Embeds using INNER JOIN - db-embed-default-join = "inner" - .. _db-use-legacy-gucs: db-use-legacy-gucs diff --git a/releases/upcoming.rst b/releases/upcoming.rst index b62c2d63f..3f79dba41 100644 --- a/releases/upcoming.rst +++ b/releases/upcoming.rst @@ -14,12 +14,8 @@ Added * Allow :ref:`embedding `, UPSERT, INSERT with Location response, OPTIONS request and OpenAPI support for partitioned tables. |br| -- `@laurenceisla `_ -* Allow filtering top-level resource based on embedded resources filters - - + This is enabled by adding ``!inner`` to the embedded resource. See :ref:`embedding_top_level_filter`. - + This behavior can be enabled by default by setting the :ref:`db-embed-default-join` to ``"inner"``. - - -- `@steve-chavez `_ +* Allow filtering top-level resource based on embedded resources filters. This is enabled by adding ``!inner`` to the embedded resource. See :ref:`embedding_top_level_filter`. + |br| -- `@steve-chavez `_ * Make GUC names for headers, cookies and jwt claims compatible with PostgreSQL v14.