From b77149d48e164ed19980272ed79530d30c34b53a Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Fri, 15 Mar 2019 21:52:38 +0800 Subject: [PATCH] update doc based on postgrest/issues/1253 (#206) --- api.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api.rst b/api.rst index 41b7f75e2..20c411365 100644 --- a/api.rst +++ b/api.rst @@ -970,6 +970,10 @@ You can make an UPSERT with :code:`POST` and the :code:`Prefer: resolution=merge UPSERT operates based on the primary key columns, you must specify all of them. You can also choose to ignore the duplicates with :code:`Prefer: resolution=ignore-duplicates`. UPSERT works best when the primary key is natural, but it's also possible to use it if the primary key is surrogate (example: "id serial primary key"). For more details read `this issue `_. +.. important:: + After creating a table or changing its primary key, you must refresh PostgREST schema cache for UPSERT to work properly. To learn how to refresh the cache see :ref:`schema_reloading`. + + A single row UPSERT can be done by using :code:`PUT` and filtering the primary key columns with :code:`eq`: .. code-block:: http