From ef36ec10a19a387454780c3ac4e3999e1650f0e1 Mon Sep 17 00:00:00 2001 From: steve-chavez Date: Tue, 21 Apr 2020 14:17:13 -0500 Subject: [PATCH] Put warning in db-schema and clarify search_path --- api.rst | 7 ++----- configuration.rst | 12 ++++++++++-- releases/upcoming.rst | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/api.rst b/api.rst index fd62a0f92..3a0a4da11 100644 --- a/api.rst +++ b/api.rst @@ -1421,18 +1421,15 @@ Switching Schemas ================= You can switch schemas at runtime with the ``Accept-Profile`` and ``Content-Profile`` headers. You can only switch to a schema that is included in :ref:`db-schema`. -This is useful for **api versioning** and **schema-based multitenancy**. -The schema to be used can be selected through the ``Accept-Profile`` header for GET or HEAD: +For GET or HEAD, the schema to be used can be selected through the ``Accept-Profile`` header: .. code-block:: http GET /items HTTP/1.1 Accept-Profile: tenant2 -If you don't specify the ``Accept-Profile`` header, the first schema on :ref:`db-schema` will be used. - -For POST, PATCH, PUT, DELETE you can use the ``Content-Profile`` header for selecting the schema: +For POST, PATCH, PUT and DELETE, you can use the ``Content-Profile`` header for selecting the schema: .. code-block:: http diff --git a/configuration.rst b/configuration.rst index 35d93d308..00d0f7ef6 100644 --- a/configuration.rst +++ b/configuration.rst @@ -75,12 +75,12 @@ db-schema The database schema to expose to REST clients. Tables, views and stored procedures in this schema will get API endpoints. - The chosen schema gets added to the `search_path `_ of every request. Example: - .. code:: bash db-schema = "api" + This schema gets added to the `search_path `_ of every request. + You can also specify a list of schemas that can be used for **schema-based multitenancy** and **api versioning** by :ref:`multiple-schemas`. Example: .. code:: bash @@ -89,6 +89,14 @@ db-schema ##or ##db-schema = "v1, v2" + .. warning:: + + Never expose private schemas in this way. See :ref:`schema_isolation`. + + If you don't :ref:`Switch Schemas `, the first schema in the list(``tenant1`` in this case) is chosen as the default schema. + + Only the chosen schema gets added to the `search_path `_ of every request. + .. _db-anon-role: db-anon-role diff --git a/releases/upcoming.rst b/releases/upcoming.rst index 8a77c509b..55eb25bd2 100644 --- a/releases/upcoming.rst +++ b/releases/upcoming.rst @@ -10,7 +10,7 @@ These are changes yet unreleased. If you'd like to try them out before a new off Added ----- -* Support for :ref:`multiple-schemas` at runtime. +* Support for :ref:`Switching to a schema ` defined in :ref:`db-schema`. |br| -- `@steve-chavez `_, `@mahmoudkassem `_ * Support for :ref:`planned_count` and :ref:`estimated_count`.