diff --git a/docs/references/api/tables_views.rst b/docs/references/api/tables_views.rst index 837dd8232..989c1f8d8 100644 --- a/docs/references/api/tables_views.rst +++ b/docs/references/api/tables_views.rst @@ -875,6 +875,56 @@ To bulk insert JSON post an array of objects having all-matching keys ] EOF +.. _bulk_insert_default: + +Bulk Insert with Default Values +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Any missing columns in the payload will be inserted as ``null`` values. To use the ``DEFAULT`` column value instead, use the ``Prefer: missing=default`` header. + +Having: + +.. code-block:: postgres + + create table foo ( + id bigint generated by default as identity primary key + , bar text + , baz int default 100 + ); + +A request: + +.. code-block:: http + + POST /foo?columns=id,bar,baz HTTP/1.1 + Content-Type: application/json + Prefer: return=representation + +.. code-block:: json + + [ + { "bar": "val1" + } + , { "bar": "val2" + , "baz": 15 + } + ] + +Will result in: + +.. code-block:: json + + [ + { "id": 1 + , "bar": "val1" + , "baz": 100 + } + , { "id": 2 + , "bar": "val2" + , "baz": 15 + } + ] + .. _specify_columns: Specifying Columns diff --git a/docs/releases/v11.0.0.rst b/docs/releases/v11.0.0.rst index a2de2b3b9..b24e61fa4 100644 --- a/docs/releases/v11.0.0.rst +++ b/docs/releases/v11.0.0.rst @@ -4,11 +4,10 @@ Features -------- -Horizontal Filtering -~~~~~~~~~~~~~~~~~~~~ +Inserts +~~~~~~~ -- New ``isdistinct`` :ref:`operator `. It is a direct translation of `IS DINTINCT FROM `_. -- New ``and/all`` :ref:`modifiers`. +- New :ref:`bulk_insert_default`. Resource Embedding ~~~~~~~~~~~~~~~~~~ @@ -18,6 +17,12 @@ Resource Embedding - New :ref:`null_embed`. - New :ref:`empty_embed`. +Horizontal Filtering +~~~~~~~~~~~~~~~~~~~~ + +- New ``isdistinct`` :ref:`operator `. It is a direct translation of `IS DINTINCT FROM `_. +- New ``and/all`` :ref:`modifiers`. + OpenAPI ~~~~~~~