added postgrest-docs-linkcheck; clean up links
* removed outdated links * updated permanent redirections * updated postgres docs links to current version * sort links in ecosystems by repo-name * change http:// to https://
This commit is contained in:
committed by
Wolfgang Walther
parent
a1178a8016
commit
92395eae8a
@@ -1,3 +1,5 @@
|
|||||||
|
.. _admin:
|
||||||
|
|
||||||
Hardening PostgREST
|
Hardening PostgREST
|
||||||
===================
|
===================
|
||||||
|
|
||||||
@@ -51,7 +53,7 @@ However it's very easy to delete the **entire table** by omitting the query para
|
|||||||
|
|
||||||
DELETE /logs HTTP/1.1
|
DELETE /logs HTTP/1.1
|
||||||
|
|
||||||
This can happen accidentally such as by switching a request from a GET to a DELETE. To protect against accidental operations use the `pg-safeupdate <https://github.com/eradman/pg-safeupdate>`_ PostgreSQL extension. It raises an error if UPDATE or DELETE are executed without specifying conditions. To install it you can use the `PGXN <http://pgxn.org/>`_ network:
|
This can happen accidentally such as by switching a request from a GET to a DELETE. To protect against accidental operations use the `pg-safeupdate <https://github.com/eradman/pg-safeupdate>`_ PostgreSQL extension. It raises an error if UPDATE or DELETE are executed without specifying conditions. To install it you can use the `PGXN <https://pgxn.org/>`_ network:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@@ -60,7 +62,7 @@ This can happen accidentally such as by switching a request from a GET to a DELE
|
|||||||
# then add this to postgresql.conf:
|
# then add this to postgresql.conf:
|
||||||
# shared_preload_libraries='safeupdate';
|
# shared_preload_libraries='safeupdate';
|
||||||
|
|
||||||
This does not protect against malicious actions, since someone can add a url parameter that does not affect the result set. To prevent this you must turn to database permissions, forbidding the wrong people from deleting rows, and using `row-level security <https://www.postgresql.org/docs/current/static/ddl-rowsecurity.html>`_ if finer access control is required.
|
This does not protect against malicious actions, since someone can add a url parameter that does not affect the result set. To prevent this you must turn to database permissions, forbidding the wrong people from deleting rows, and using `row-level security <https://www.postgresql.org/docs/current/ddl-rowsecurity.html>`_ if finer access control is required.
|
||||||
|
|
||||||
Count-Header DoS
|
Count-Header DoS
|
||||||
----------------
|
----------------
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ The view will provide a new endpoint:
|
|||||||
Full-Text Search
|
Full-Text Search
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
The :code:`fts` filter mentioned above has a number of options to support flexible textual queries, namely the choice of plain vs phrase search and the language used for stemming. Suppose that :code:`tsearch` is a table with column :code:`my_tsv`, of type `tsvector <https://www.postgresql.org/docs/current/static/datatype-textsearch.html>`_. The following examples illustrate the possibilities.
|
The :code:`fts` filter mentioned above has a number of options to support flexible textual queries, namely the choice of plain vs phrase search and the language used for stemming. Suppose that :code:`tsearch` is a table with column :code:`my_tsv`, of type `tsvector <https://www.postgresql.org/docs/current/datatype-textsearch.html>`_. The following examples illustrate the possibilities.
|
||||||
|
|
||||||
.. code-block:: http
|
.. code-block:: http
|
||||||
|
|
||||||
@@ -183,7 +183,7 @@ Casting the columns is possible by suffixing them with the double colon ``::`` p
|
|||||||
JSON Columns
|
JSON Columns
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
You can specify a path for a ``json`` or ``jsonb`` column using the arrow operators(``->`` or ``->>``) as per the `PostgreSQL docs <https://www.postgresql.org/docs/9.5/static/functions-json.html>`_.
|
You can specify a path for a ``json`` or ``jsonb`` column using the arrow operators(``->`` or ``->>``) as per the `PostgreSQL docs <https://www.postgresql.org/docs/current/functions-json.html>`_.
|
||||||
|
|
||||||
.. code-block:: http
|
.. code-block:: http
|
||||||
|
|
||||||
@@ -427,7 +427,7 @@ To do this, specify the ``Prefer: count=planned`` header.
|
|||||||
|
|
||||||
Note that the accuracy of this count depends on how up-to-date are the PostgreSQL statistics tables.
|
Note that the accuracy of this count depends on how up-to-date are the PostgreSQL statistics tables.
|
||||||
For example in this case, to increase the accuracy of the count you can do ``ANALYZE bigtable``.
|
For example in this case, to increase the accuracy of the count you can do ``ANALYZE bigtable``.
|
||||||
See `ANALYZE <https://www.postgresql.org/docs/11/sql-analyze.html>`_ for more details.
|
See `ANALYZE <https://www.postgresql.org/docs/current/sql-analyze.html>`_ for more details.
|
||||||
|
|
||||||
.. _estimated_count:
|
.. _estimated_count:
|
||||||
|
|
||||||
@@ -676,14 +676,14 @@ Since it contains ``competition_id`` and ``film_id`` — and each one has a **fo
|
|||||||
|
|
||||||
GET /nominations_view?select=rank,competitions(name,year),films(title)&rank=eq.5 HTTP/1.1
|
GET /nominations_view?select=rank,competitions(name,year),films(title)&rank=eq.5 HTTP/1.1
|
||||||
|
|
||||||
It's also possible to embed `Materialized Views <https://www.postgresql.org/docs/11/rules-materializedviews.html>`_.
|
It's also possible to embed `Materialized Views <https://www.postgresql.org/docs/current/rules-materializedviews.html>`_.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
It's not guaranteed that all kinds of views will be embeddable. In particular, views that contain
|
It's not guaranteed that all kinds of views will be embeddable. In particular, views that contain
|
||||||
UNIONs will not be made embeddable.
|
UNIONs will not be made embeddable.
|
||||||
|
|
||||||
Why? PostgREST detects source table foreign keys in the view by querying and parsing `pg_rewrite <https://www.postgresql.org/docs/11/catalog-pg-rewrite.html>`_.
|
Why? PostgREST detects source table foreign keys in the view by querying and parsing `pg_rewrite <https://www.postgresql.org/docs/current/catalog-pg-rewrite.html>`_.
|
||||||
This may fail depending on the complexity of the view.
|
This may fail depending on the complexity of the view.
|
||||||
|
|
||||||
`Report an issue <https://github.com/PostgREST/postgrest/issues>`_ if your view is not made embeddable so we can
|
`Report an issue <https://github.com/PostgREST/postgrest/issues>`_ if your view is not made embeddable so we can
|
||||||
@@ -879,7 +879,7 @@ Similarly to the **target**, the **hint** can be a **table name**, **foreign key
|
|||||||
Insertions / Updates
|
Insertions / Updates
|
||||||
====================
|
====================
|
||||||
|
|
||||||
All tables and `auto-updatable views <https://www.postgresql.org/docs/current/static/sql-createview.html#SQL-CREATEVIEW-UPDATABLE-VIEWS>`_ can be modified through the API, subject to permissions of the requester's database role.
|
All tables and `auto-updatable views <https://www.postgresql.org/docs/current/sql-createview.html#SQL-CREATEVIEW-UPDATABLE-VIEWS>`_ can be modified through the API, subject to permissions of the requester's database role.
|
||||||
|
|
||||||
To create a row in a database table post a JSON object whose keys are the names of the columns you would like to create. Missing properties will be set to default values when applicable.
|
To create a row in a database table post a JSON object whose keys are the names of the columns you would like to create. Missing properties will be set to default values when applicable.
|
||||||
|
|
||||||
@@ -1044,7 +1044,7 @@ All the columns must be specified in the request body, including the primary key
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Upsert features are only available starting from PostgreSQL 9.5 since it uses the `ON CONFLICT clause <https://www.postgresql.org/docs/9.5/static/sql-insert.html#SQL-ON-CONFLICT>`_.
|
Upsert features are only available starting from PostgreSQL 9.5 since it uses the `ON CONFLICT clause <https://www.postgresql.org/docs/current/sql-insert.html#SQL-ON-CONFLICT>`_.
|
||||||
|
|
||||||
.. _delete:
|
.. _delete:
|
||||||
|
|
||||||
@@ -1138,7 +1138,7 @@ Procedures must be declared with named parameters. Procedures declared like
|
|||||||
|
|
||||||
CREATE FUNCTION non_named_args(integer, text, integer) ...
|
CREATE FUNCTION non_named_args(integer, text, integer) ...
|
||||||
|
|
||||||
cannot be called with PostgREST, since we use `named notation <https://www.postgresql.org/docs/current/static/sql-syntax-calling-funcs.html#SQL-SYNTAX-CALLING-FUNCS-NAMED>`_ internally.
|
cannot be called with PostgREST, since we use `named notation <https://www.postgresql.org/docs/current/sql-syntax-calling-funcs.html#SQL-SYNTAX-CALLING-FUNCS-NAMED>`_ internally.
|
||||||
|
|
||||||
Note that PostgreSQL converts identifier names to lowercase unless you quote them like:
|
Note that PostgreSQL converts identifier names to lowercase unless you quote them like:
|
||||||
|
|
||||||
@@ -1161,7 +1161,7 @@ Procedures that do not modify the database can be called with the HTTP GET verb
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
The `volatility marker <https://www.postgresql.org/docs/current/static/xfunc-volatility.html>`_ is a promise about the behavior of the function. PostgreSQL will let you mark a function that modifies the database as ``IMMUTABLE`` or ``STABLE`` without failure. However, because of the read-only transaction this would still fail with PostgREST.
|
The `volatility marker <https://www.postgresql.org/docs/current/xfunc-volatility.html>`_ is a promise about the behavior of the function. PostgreSQL will let you mark a function that modifies the database as ``IMMUTABLE`` or ``STABLE`` without failure. However, because of the read-only transaction this would still fail with PostgREST.
|
||||||
|
|
||||||
Because ``add_them`` is ``IMMUTABLE``, we can alternately call the function with a GET request:
|
Because ``add_them`` is ``IMMUTABLE``, we can alternately call the function with a GET request:
|
||||||
|
|
||||||
@@ -1215,7 +1215,7 @@ You can call a function that takes an array parameter:
|
|||||||
|
|
||||||
[2,3,4,5]
|
[2,3,4,5]
|
||||||
|
|
||||||
For calling the function with GET, you can pass the array as an `array literal <https://www.postgresql.org/docs/11/arrays.html#ARRAYS-INPUT>`_,
|
For calling the function with GET, you can pass the array as an `array literal <https://www.postgresql.org/docs/current/arrays.html#ARRAYS-INPUT>`_,
|
||||||
as in ``{1,2,3,4}``. Note that the curly brackets have to be urlencoded(``{`` is ``%7B`` and ``}`` is ``%7D``).
|
as in ``{1,2,3,4}``. Note that the curly brackets have to be urlencoded(``{`` is ``%7B`` and ``}`` is ``%7D``).
|
||||||
|
|
||||||
.. code-block:: http
|
.. code-block:: http
|
||||||
@@ -1420,7 +1420,7 @@ This follows the same rules as :ref:`binary_output`.
|
|||||||
OpenAPI Support
|
OpenAPI Support
|
||||||
===============
|
===============
|
||||||
|
|
||||||
Every API hosted by PostgREST automatically serves a full `OpenAPI <https://www.openapis.org/>`_ description on the root path. This provides a list of all endpoints(tables, foreign tables, views, functions), along with supported HTTP verbs and example payloads. For extra customization, the OpenAPI output contains a "description" field for every `SQL comment <https://www.postgresql.org/docs/current/static/sql-comment.html>`_ on any database object. For instance,
|
Every API hosted by PostgREST automatically serves a full `OpenAPI <https://www.openapis.org/>`_ description on the root path. This provides a list of all endpoints(tables, foreign tables, views, functions), along with supported HTTP verbs and example payloads. For extra customization, the OpenAPI output contains a "description" field for every `SQL comment <https://www.postgresql.org/docs/current/sql-comment.html>`_ on any database object. For instance,
|
||||||
|
|
||||||
.. code-block:: sql
|
.. code-block:: sql
|
||||||
|
|
||||||
@@ -1446,7 +1446,7 @@ Also if you wish to generate a ``summary`` field you can do it by having a multi
|
|||||||
spans
|
spans
|
||||||
multiple lines$$;
|
multiple lines$$;
|
||||||
|
|
||||||
You can use a tool like `Swagger UI <http://swagger.io/swagger-ui/>`_ to create beautiful documentation from the description and to host an interactive web-based dashboard. The dashboard allows developers to make requests against a live PostgREST server, and provides guidance with request headers and example request bodies.
|
You can use a tool like `Swagger UI <https://swagger.io/tools/swagger-ui/>`_ to create beautiful documentation from the description and to host an interactive web-based dashboard. The dashboard allows developers to make requests against a live PostgREST server, and provides guidance with request headers and example request bodies.
|
||||||
|
|
||||||
.. important::
|
.. important::
|
||||||
|
|
||||||
@@ -1664,7 +1664,7 @@ Returns:
|
|||||||
HTTP Status Codes
|
HTTP Status Codes
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
PostgREST translates `PostgreSQL error codes <https://www.postgresql.org/docs/current/static/errcodes-appendix.html>`_ into HTTP status as follows:
|
PostgREST translates `PostgreSQL error codes <https://www.postgresql.org/docs/current/errcodes-appendix.html>`_ into HTTP status as follows:
|
||||||
|
|
||||||
+--------------------------+-------------------------+---------------------------------+
|
+--------------------------+-------------------------+---------------------------------+
|
||||||
| PostgreSQL error code(s) | HTTP status | Error description |
|
| PostgreSQL error code(s) | HTTP status | Error description |
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ The authenticator should be created :code:`NOINHERIT` and configured in the data
|
|||||||
|
|
||||||
.. image:: _static/security-anon-choice.png
|
.. image:: _static/security-anon-choice.png
|
||||||
|
|
||||||
Here are the technical details. We use `JSON Web Tokens <http://jwt.io/>`_ to authenticate API requests. As you'll recall a JWT contains a list of cryptographically signed claims. All claims are allowed but PostgREST cares specifically about a claim called role.
|
Here are the technical details. We use `JSON Web Tokens <https://jwt.io/>`_ to authenticate API requests. As you'll recall a JWT contains a list of cryptographically signed claims. All claims are allowed but PostgREST cares specifically about a claim called role.
|
||||||
|
|
||||||
.. code:: json
|
.. code:: json
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ Roles for Each Web User
|
|||||||
|
|
||||||
PostgREST can accommodate either viewpoint. If you treat a role as a single user then the JWT-based role switching described above does most of what you need. When an authenticated user makes a request PostgREST will switch into the role for that user, which in addition to restricting queries, is available to SQL through the :code:`current_user` variable.
|
PostgREST can accommodate either viewpoint. If you treat a role as a single user then the JWT-based role switching described above does most of what you need. When an authenticated user makes a request PostgREST will switch into the role for that user, which in addition to restricting queries, is available to SQL through the :code:`current_user` variable.
|
||||||
|
|
||||||
You can use row-level security to flexibly restrict visibility and access for the current user. Here is an `example <http://blog.2ndquadrant.com/application-users-vs-row-level-security/>`_ from Tomas Vondra, a chat table storing messages sent between users. Users can insert rows into it to send messages to other users, and query it to see messages sent to them by other users.
|
You can use row-level security to flexibly restrict visibility and access for the current user. Here is an `example <https://www.2ndquadrant.com/en/blog/application-users-vs-row-level-security/>`_ from Tomas Vondra, a chat table storing messages sent between users. Users can insert rows into it to send messages to other users, and query it to see messages sent to them by other users.
|
||||||
|
|
||||||
.. code-block:: postgres
|
.. code-block:: postgres
|
||||||
|
|
||||||
@@ -208,14 +208,14 @@ To use Auth0, create `an application <https://auth0.com/docs/applications>`_ for
|
|||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
Our code requires a database role in the JWT. To add it you need to save the database role in Auth0 `app metadata <https://auth0.com/docs/rules/metadata-in-rules>`_. Then, you will need to write `a rule <https://auth0.com/docs/rules>`_ that will extract the role from the user's app_metadata and set it as a `custom claim <https://auth0.com/docs/scopes/sample-use-cases-scopes-and-claims#add-custom-claims-to-a-token>`_ in the access token. Note that, you may use Auth0's `core authorization feature <https://auth0.com/docs/authorization/rbac>`_ for more complex use cases. Metadata solution is mentioned here for simplicity.
|
Our code requires a database role in the JWT. To add it you need to save the database role in Auth0 `app metadata <https://auth0.com/docs/rules/metadata>`_. Then, you will need to write `a rule <https://auth0.com/docs/rules>`_ that will extract the role from the user's app_metadata and set it as a `custom claim <https://auth0.com/docs/scopes/sample-use-cases-scopes-and-claims#add-custom-claims-to-a-token>`_ in the access token. Note that, you may use Auth0's `core authorization feature <https://auth0.com/docs/authorization/rbac>`_ for more complex use cases. Metadata solution is mentioned here for simplicity.
|
||||||
|
|
||||||
.. code:: javascript
|
.. code:: javascript
|
||||||
|
|
||||||
function (user, context, callback) {
|
function (user, context, callback) {
|
||||||
|
|
||||||
// Follow the documentations at
|
// Follow the documentations at
|
||||||
// http://postgrest.org/en/latest/configuration.html#role-claim-key
|
// https://postgrest.org/en/latest/configuration.html#role-claim-key
|
||||||
// to set a custom role claim on PostgREST
|
// to set a custom role claim on PostgREST
|
||||||
// and use it as custom claim attribute in this rule
|
// and use it as custom claim attribute in this rule
|
||||||
const myRoleClaim = 'https://myapp.com/role';
|
const myRoleClaim = 'https://myapp.com/role';
|
||||||
|
|||||||
+6
-6
@@ -16,7 +16,7 @@ The configuration file must contain a set of key value pairs. At minimum you mus
|
|||||||
# postgrest.conf
|
# postgrest.conf
|
||||||
|
|
||||||
# The standard connection URI format, documented at
|
# The standard connection URI format, documented at
|
||||||
# https://www.postgresql.org/docs/current/static/libpq-connect.html#AEN45347
|
# https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING
|
||||||
db-uri = "postgres://user:pass@host:5432/dbname"
|
db-uri = "postgres://user:pass@host:5432/dbname"
|
||||||
|
|
||||||
# The name of which database schema to expose to REST clients
|
# The name of which database schema to expose to REST clients
|
||||||
@@ -59,9 +59,9 @@ raw-media-types String
|
|||||||
db-uri
|
db-uri
|
||||||
------
|
------
|
||||||
|
|
||||||
The standard connection PostgreSQL `URI format <https://www.postgresql.org/docs/current/static/libpq-connect.html#AEN45347>`_. Symbols and unusual characters in the password or other fields should be percent encoded to avoid a parse error. If enforcing an SSL connection to the database is required you can use `sslmode <https://www.postgresql.org/docs/9.1/static/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS>`_ in the URI, for example ``postgres://user:pass@host:5432/dbname?sslmode=require``.
|
The standard connection PostgreSQL `URI format <https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING>`_. Symbols and unusual characters in the password or other fields should be percent encoded to avoid a parse error. If enforcing an SSL connection to the database is required you can use `sslmode <https://www.postgresql.org/docs/current/libpq-ssl.html#LIBPQ-SSL-SSLMODE-STATEMENTS>`_ in the URI, for example ``postgres://user:pass@host:5432/dbname?sslmode=require``.
|
||||||
|
|
||||||
When running PostgREST on the same machine as PostgreSQL, it is also possible to connect to the database using a `Unix socket <https://en.wikipedia.org/wiki/Unix_domain_socket>`_ and the `Peer Authentication method <http://www.postgresql.org/docs/current/static/auth-methods.html#AUTH-PEER>`_ as an alternative to TCP/IP communication and authentication with a password, this also grants higher performance. To do this you can omit the host and the password, e.g. ``postgres://user@/dbname``, see the `libpq connection string <https://www.postgresql.org/docs/10/static/libpq-connect.html#LIBPQ-CONNSTRING>`_ documentation for more details.
|
When running PostgREST on the same machine as PostgreSQL, it is also possible to connect to the database using a `Unix socket <https://en.wikipedia.org/wiki/Unix_domain_socket>`_ and the `Peer Authentication method <https://www.postgresql.org/docs/current/auth-peer.html>`_ as an alternative to TCP/IP communication and authentication with a password, this also grants higher performance. To do this you can omit the host and the password, e.g. ``postgres://user@/dbname``, see the `libpq connection string <https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING>`_ documentation for more details.
|
||||||
|
|
||||||
On older systems like Centos 6, with older versions of libpq, a different db-uri syntax has to be used. In this case the URI is a string of space separated key-value pairs (key=value), so the example above would be :code:`"host=host user=user port=5432 dbname=dbname password=pass"`.
|
On older systems like Centos 6, with older versions of libpq, a different db-uri syntax has to be used. In this case the URI is a string of space separated key-value pairs (key=value), so the example above would be :code:`"host=host user=user port=5432 dbname=dbname password=pass"`.
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ db-schema
|
|||||||
|
|
||||||
db-schema = "api"
|
db-schema = "api"
|
||||||
|
|
||||||
This schema gets added to the `search_path <https://www.postgresql.org/docs/11/ddl-schemas.html#DDL-SCHEMAS-PATH>`_ of every request.
|
This schema gets added to the `search_path <https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH>`_ of every request.
|
||||||
|
|
||||||
List of schemas
|
List of schemas
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
@@ -92,7 +92,7 @@ List of schemas
|
|||||||
|
|
||||||
If you don't :ref:`Switch Schemas <multiple-schemas>`, the first schema in the list(``tenant1`` in this case) is chosen as the default schema.
|
If you don't :ref:`Switch Schemas <multiple-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 <https://www.postgresql.org/docs/11/ddl-schemas.html#DDL-SCHEMAS-PATH>`_ of every request.
|
*Only the chosen schema* gets added to the `search_path <https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH>`_ of every request.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ db-pool-timeout
|
|||||||
db-extra-search-path
|
db-extra-search-path
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
Extra schemas to add to the `search_path <https://www.postgresql.org/docs/11/ddl-schemas.html#DDL-SCHEMAS-PATH>`_ of every request. These schemas tables, views and stored procedures **don't get API endpoints**, they can only be referred from the database objects inside your :ref:`db-schema`.
|
Extra schemas to add to the `search_path <https://www.postgresql.org/docs/current/ddl-schemas.html#DDL-SCHEMAS-PATH>`_ of every request. These schemas tables, views and stored procedures **don't get API endpoints**, they can only be referred from the database objects inside your :ref:`db-schema`.
|
||||||
|
|
||||||
This parameter was meant to make it easier to use **PostgreSQL extensions** (like PostGIS) that are outside of the :ref:`db-schema`.
|
This parameter was meant to make it easier to use **PostgreSQL extensions** (like PostGIS) that are outside of the :ref:`db-schema`.
|
||||||
|
|
||||||
|
|||||||
+11
-3
@@ -1,9 +1,9 @@
|
|||||||
let
|
let
|
||||||
# Commit of the Nixpkgs repository that we want to use.
|
# Commit of the Nixpkgs repository that we want to use.
|
||||||
nixpkgsVersion = {
|
nixpkgsVersion = {
|
||||||
date = "2020-10-27";
|
date = "2021-04-04";
|
||||||
rev = "cd63096d6d887d689543a0b97743d28995bc9bc3";
|
rev = "c0e881852006b132236cbf0301bd1939bb50867e";
|
||||||
tarballHash = "1wg61h4gndm3vcprdcg7rc4s1v3jkm5xd7lw8r2f67w502y94gcy";
|
tarballHash = "0fy7z7yxk5n7yslsvx5cyc6h21qwi4bhxf3awhirniszlbvaazy2";
|
||||||
};
|
};
|
||||||
|
|
||||||
# Nix files that describe the Nixpkgs repository. We evaluate the expression
|
# Nix files that describe the Nixpkgs repository. We evaluate the expression
|
||||||
@@ -72,4 +72,12 @@ in
|
|||||||
| xargs -0 -n 1 -i \
|
| xargs -0 -n 1 -i \
|
||||||
sh -c "grep \"{}\" $FILES > /dev/null || echo \"{}\""
|
sh -c "grep \"{}\" $FILES > /dev/null || echo \"{}\""
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
linkcheck =
|
||||||
|
pkgs.writeShellScriptBin "postgrest-docs-linkcheck"
|
||||||
|
''
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
${python}/bin/sphinx-build -b linkcheck . _build
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
+60
-61
@@ -19,27 +19,26 @@ Community Tutorials
|
|||||||
Example Apps
|
Example Apps
|
||||||
------------
|
------------
|
||||||
|
|
||||||
* `monacoremo/postgrest-sessions-example <https://github.com/monacoremo/postgrest-sessions-example>`_ - example for cookie-based sessions
|
* `blogdemo <https://github.com/ruslantalpa/blogdemo>`_ - blog api demo in a vagrant image
|
||||||
* `tatut/postgrest-ui <https://github.com/tatut/postgrest-ui>`_ - ClojureScript UI components for PostgREST
|
* `chronicle <https://github.com/srid/chronicle>`_ - tracking a tree of personal memories
|
||||||
* `priyank-purohit/PostGUI <https://github.com/priyank-purohit/PostGUI>`_ - React Material UI admin panel
|
* `elm-workshop <https://github.com/diogob/elm-workshop>`_ - building a simple database query UI
|
||||||
* `Qu4tro/pgrst-dev-setup <https://github.com/Qu4tro/pgrst-dev-setup>`_ - docker-compose and tmuxp setup for experimentation.
|
* `ember-postgrest-dynamic-ui <https://github.com/benoror/ember-postgrest-dynamic-ui>`_ - generating Ember forms to edit data
|
||||||
* `subzerocloud/postgrest-starter-kit <https://github.com/subzerocloud/postgrest-starter-kit>`_ - boilerplate for new project
|
* `ext-postgrest-crud <https://github.com/timwis/ext-postgrest-crud>`_ - browser-based spreadsheet
|
||||||
* `NikolayS/postgrest-google-translate <https://github.com/NikolayS/postgrest-google-translate>`_ - calling to external translation service
|
* `general <https://github.com/PierreRochard/general>`_ - example auth back-end
|
||||||
* `CodeforAustralia/heritage-near-me <https://github.com/CodeforAustralia/heritage-near-me>`_ - Elm and PostgREST with PostGIS
|
* `goodfilm <https://github.com/tyrchen/goodfilm>`_ - example film api
|
||||||
* `timwis/handsontable-postgrest <https://github.com/timwis/handsontable-postgrest>`_ - an excel-like database table editor
|
* `handsontable-postgrest <https://github.com/timwis/handsontable-postgrest>`_ - an excel-like database table editor
|
||||||
* `Recmo/PostgrestSkeleton <https://github.com/Recmo/PostgrestSkeleton>`_ - Docker Compose, PostgREST, Nginx and Auth0
|
* `heritage-near-me <https://github.com/CodeforAustralia/heritage-near-me>`_ - Elm and PostgREST with PostGIS
|
||||||
* `benoror/ember-postgrest-dynamic-ui <https://github.com/benoror/ember-postgrest-dynamic-ui>`_ - generating Ember forms to edit data
|
* `ng-admin-postgrest <https://github.com/marmelab/ng-admin-postgrest>`_ - automatic database admin panel
|
||||||
* `ruslantalpa/blogdemo <https://github.com/ruslantalpa/blogdemo>`_ - blog api demo in a vagrant image
|
* `pgrst-dev-setup <https://github.com/Qu4tro/pgrst-dev-setup>`_ - docker-compose and tmuxp setup for experimentation.
|
||||||
* `timwis/ext-postgrest-crud <https://github.com/timwis/ext-postgrest-crud>`_ - browser-based spreadsheet
|
* `postgrest-demo <https://github.com/SMRxT/postgrest-demo>`_ - multi-tenant logging system
|
||||||
* `srid/chronicle <https://github.com/srid/chronicle>`_ - tracking a tree of personal memories
|
* `postgrest-example <https://github.com/begriffs/postgrest-example>`_ - sqitch versioning for API
|
||||||
* `diogob/elm-workshop <https://github.com/diogob/elm-workshop>`_ - building a simple database query UI
|
* `postgrest-sessions-example <https://github.com/monacoremo/postgrest-sessions-example>`_ - example for cookie-based sessions
|
||||||
* `myfreeweb/moneylog <https://github.com/myfreeweb/moneylog>`_ - accounting web app in Polymer + PostgREST
|
* `postgrest-starter-kit <https://github.com/subzerocloud/postgrest-starter-kit>`_ - boilerplate for new project
|
||||||
* `tyrchen/goodfilm <https://github.com/tyrchen/goodfilm>`_ - example film api
|
* `postgrest-translation-proxy <https://github.com/NikolayS/postgrest-translation-proxy>`_ - calling to external translation service
|
||||||
* `begriffs/postgrest-example <https://github.com/begriffs/postgrest-example>`_ - sqitch versioning for API
|
* `postgrest-ui <https://github.com/tatut/postgrest-ui>`_ - ClojureScript UI components for PostgREST
|
||||||
* `SMRxT/postgrest-demo <https://github.com/SMRxT/postgrest-demo>`_ - multi-tenant logging system
|
* `postgrest-vercel <https://github.com/seveibar/postgrest-vercel>`_ - run PostgREST on Vercel (Serverless/AWS Lambda)
|
||||||
* `PierreRochard/postgrest-boilerplate <https://github.com/PierreRochard/postgrest-boilerplate>`_ - example auth back-end
|
* `PostgrestSkeleton <https://github.com/Recmo/PostgrestSkeleton>`_ - Docker Compose, PostgREST, Nginx and Auth0
|
||||||
* `marmelab/ng-admin-postgrest <https://github.com/marmelab/ng-admin-postgrest>`_ - automatic database admin panel
|
* `PostGUI <https://github.com/priyank-purohit/PostGUI>`_ - React Material UI admin panel
|
||||||
* `seveibar/postgrest-vercel <https://github.com/seveibar/postgrest-vercel>`_ - run PostgREST on Vercel (Serverless/AWS Lambda)
|
|
||||||
|
|
||||||
.. _eco_external_notification:
|
.. _eco_external_notification:
|
||||||
|
|
||||||
@@ -48,14 +47,14 @@ External Notification
|
|||||||
|
|
||||||
These are PostgreSQL bridges that propagate LISTEN/NOTIFY to external queues for further processing. This allows stored procedures to initiate actions outside the database such as sending emails.
|
These are PostgreSQL bridges that propagate LISTEN/NOTIFY to external queues for further processing. This allows stored procedures to initiate actions outside the database such as sending emails.
|
||||||
|
|
||||||
* `vbalasu/pg-notify-webhook <https://pypi.org/project/pg-notify-webhook/>`_ - trigger webhooks from PostgreSQL's LISTEN/NOTIFY
|
* `pg-bridge <https://github.com/matthewmueller/pg-bridge>`_ - Amazon SNS
|
||||||
* `diogob/postgres-websockets <https://github.com/diogob/postgres-websockets>`_ - expose web sockets for PostgreSQL's LISTEN/NOTIFY
|
* `pg-kinesis-bridge <https://github.com/daurnimator/pg-kinesis-bridge>`_ - Amazon Kinesis
|
||||||
* `frafra/postgresql2websocket <https://github.com/frafra/postgresql2websocket>`_ - Websockets
|
* `pg-notify-webhook <https://github.com/vbalasu/pg-notify-webhook>`_ - trigger webhooks from PostgreSQL's LISTEN/NOTIFY
|
||||||
* `matthewmueller/pg-bridge <https://github.com/matthewmueller/pg-bridge>`_ - Amazon SNS
|
* `pgsql-listen-exchange <https://github.com/gmr/pgsql-listen-exchange>`_ - RabbitMQ
|
||||||
* `aweber/pgsql-listen-exchange <https://github.com/aweber/pgsql-listen-exchange>`_ - RabbitMQ
|
* `postgres-websockets <https://github.com/diogob/postgres-websockets>`_ - expose web sockets for PostgreSQL's LISTEN/NOTIFY
|
||||||
* `SpiderOak/skeeter <https://github.com/SpiderOak/skeeter>`_ - ZeroMQ
|
* `postgresql-to-amqp <https://github.com/FGRibreau/postgresql-to-amqp>`_ - AMQP
|
||||||
* `FGRibreau/postgresql-to-amqp <https://github.com/FGRibreau/postgresql-to-amqp>`_ - AMQP
|
* `postgresql2websocket <https://github.com/frafra/postgresql2websocket>`_ - Websockets
|
||||||
* `daurnimator/pg-kinesis-bridge <https://github.com/daurnimator/pg-kinesis-bridge>`_ - Amazon Kinesis
|
* `skeeter <https://github.com/SpiderOak/skeeter>`_ - ZeroMQ
|
||||||
|
|
||||||
|
|
||||||
.. _eco_extensions:
|
.. _eco_extensions:
|
||||||
@@ -63,45 +62,45 @@ These are PostgreSQL bridges that propagate LISTEN/NOTIFY to external queues for
|
|||||||
Extensions
|
Extensions
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* `aiodata <https://github.com/Exahilosys/aiodata>`_ - Python, event-based proxy and caching client.
|
||||||
* `pg-safeupdate <https://github.com/eradman/pg-safeupdate>`_ - prevent full-table updates or deletes
|
* `pg-safeupdate <https://github.com/eradman/pg-safeupdate>`_ - prevent full-table updates or deletes
|
||||||
* `srid/spas <https://github.com/srid/spas>`_ - allow file uploads and basic auth
|
* `postgrest-auth (criles25) <https://github.com/criles25/postgrest-auth>`_ - email based auth/signup
|
||||||
* `svmnotn/postgrest-auth <https://github.com/svmnotn/postgrest-auth>`_ - OAuth2-inspired external auth server
|
* `postgrest-auth (svmotn) <https://github.com/svmnotn/postgrest-auth>`_ - OAuth2-inspired external auth server
|
||||||
* `wildsurfer/postgrest-oauth-server <https://github.com/wildsurfer/postgrest-oauth-server>`_ - OAuth2 server
|
* `postgrest-node <https://github.com/seveibar/postgrest-node>`_ - Run a PostgREST server in Node.js via npm module
|
||||||
* `nblumoe/postgrest-oauth <https://github.com/nblumoe/postgrest-oauth>`_ - OAuth2 WAI middleware
|
* `postgrest-oauth <https://github.com/nblumoe/postgrest-oauth>`_ - OAuth2 WAI middleware
|
||||||
* `criles25/postgrest-auth <https://github.com/criles25/postgrest-auth>`_ - email based auth/signup
|
* `postgrest-oauth/api <https://github.com/postgrest-oauth/api>`_ - OAuth2 server
|
||||||
* `ppKrauss/PostgREST-writeAPI <https://github.com/ppKrauss/PostgREST-writeAPI>`_ - generate nginx rewrite rules to fit an OpenAPI spec
|
* `PostgREST-writeAPI <https://github.com/ppKrauss/PostgREST-writeAPI>`_ - generate nginx rewrite rules to fit an OpenAPI spec
|
||||||
* `seveibar/postgrest-node <https://github.com/seveibar/postgrest-node>`_ - Run a PostgREST server in Node.js via npm module
|
* `spas <https://github.com/srid/spas>`_ - allow file uploads and basic auth
|
||||||
* `Exahilosys/aiodata <https://github.com/Exahilosys/aiodata>`_ - Python, event-based proxy and caching client.
|
|
||||||
|
|
||||||
.. _clientside_libraries:
|
.. _clientside_libraries:
|
||||||
|
|
||||||
Client-Side Libraries
|
Client-Side Libraries
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
* `supabase/postgrest-js <https://github.com/supabase/postgrest-js>`_ - TypeScript/JavaScript
|
* `aor-postgrest-client <https://github.com/tomberek/aor-postgrest-client>`_ - JS, admin-on-rest
|
||||||
* `supabase/postgrest-rs <https://github.com/supabase/postgrest-rs>`_ - Rust
|
* `elm-postgrest <https://github.com/john-kelly/elm-postgrest>`_ - Elm
|
||||||
* `supabase/postgrest-dart <https://github.com/supabase/postgrest-dart>`_ - Dart
|
* `general-angular <https://github.com/PierreRochard/general-angular>`_ - TypeScript, generate UI from API description
|
||||||
* `supabase/postgrest-py <https://github.com/supabase/postgrest-py>`_ - Python
|
* `jarvus-postgrest-apikit <https://github.com/JarvusInnovations/jarvus-postgrest-apikit>`_ - JS, Sencha framework
|
||||||
* `supabase/postgrest-csharp <https://github.com/supabase/postgrest-csharp>`_ - C#
|
* `mithril-postgrest <https://github.com/catarse/mithril-postgrest>`_ - JS, Mithril
|
||||||
* `supabase/postgrest-kt <https://github.com/supabase/postgrest-kt>`_ - Kotlin
|
* `ng-postgrest <https://github.com/team142/ng-postgrest>`_ - Angular app for browsing, editing data exposed over PostgREST.
|
||||||
* `supabase/postgrest-swift <https://github.com/supabase/postgrest-kt>`_ - Swift
|
* `postgrest-client <https://github.com/calebmer/postgrest-client>`_ - JS
|
||||||
* `technowledgy/vue-postgrest <https://github.com/technowledgy/vue-postgrest>`_ - Vue.js
|
* `postgrest-csharp <https://github.com/supabase/postgrest-csharp>`_ - C#
|
||||||
* `SocialGouv/postgrester <https://github.com/SocialGouv/postgrester>`_ - JS + Typescript
|
* `postgrest-dart <https://github.com/supabase/postgrest-dart>`_ - Dart
|
||||||
* `Kong/py-postgrest <https://github.com/Kong/py-postgrest>`_ - Python
|
* `postgrest-js <https://github.com/supabase/postgrest-js>`_ - TypeScript/JavaScript
|
||||||
* `datrium/postgrest-pyclient <https://github.com/datrium/postgrest-pyclient>`_ - Python
|
* `postgrest-kt <https://github.com/supabase/postgrest-kt>`_ - Kotlin
|
||||||
* `tomberek/aor-postgrest-client <https://github.com/tomberek/aor-postgrest-client>`_ - JS, admin-on-rest
|
* `postgrest-py <https://github.com/supabase/postgrest-py>`_ - Python
|
||||||
* `hugomrdias/postgrest-url <https://github.com/hugomrdias/postgrest-url>`_ - JS, just for generating query URLs
|
* `postgrest-pyclient <https://github.com/datrium/postgrest-pyclient>`_ - Python
|
||||||
* `john-kelly/elm-postgrest <https://github.com/john-kelly/elm-postgrest>`_ - Elm
|
* `postgrest-request <https://github.com/lewisjared/postgrest-request>`_ - JS, SuperAgent
|
||||||
* `mithril.postgrest <https://github.com/catarse/mithril.postgrest>`_ - JS, Mithril
|
* `postgrest-rs <https://github.com/supabase/postgrest-rs>`_ - Rust
|
||||||
* `lewisjared/postgrest-request <https://github.com/lewisjared/postgrest-request>`_ - JS, SuperAgent
|
* `postgrest-sharp-client <https://github.com/thejettdurham/postgrest-sharp-client>`_ (needs maintainer) - C#, RestSharp
|
||||||
* `JarvusInnovations/jarvus-postgrest-apikit <https://github.com/JarvusInnovations/jarvus-postgrest-apikit>`_ - JS, Sencha framework
|
* `postgrest-swift <https://github.com/supabase/postgrest-kt>`_ - Swift
|
||||||
* `davidthewatson/postgrest_python_requests_client <https://github.com/davidthewatson/postgrest_python_requests_client>`_ - Python
|
* `postgrest-url <https://github.com/hugomrdias/postgrest-url>`_ - JS, just for generating query URLs
|
||||||
* `calebmer/postgrest-client <https://github.com/calebmer/postgrest-client>`_ - JS
|
* `postgrestR <https://github.com/clesiemo3/postgrestR>`_ - R
|
||||||
* `clesiemo3/postgrestR <https://github.com/clesiemo3/postgrestR>`_ - R
|
* `postgrest_python_requests_client <https://github.com/davidthewatson/postgrest_python_requests_client>`_ - Python
|
||||||
* `PierreRochard/postgrest-angular <https://github.com/PierreRochard/postgrest-angular>`_ - TypeScript, generate UI from API description
|
* `postgrester <https://github.com/SocialGouv/postgrester>`_ - JS + Typescript
|
||||||
* `thejettdurham/postgrest-sharp-client <https://github.com/thejettdurham/postgrest-sharp-client>`_ (needs maintainer) - C#, RestSharp
|
* `py-postgrest <https://github.com/Kong/py-postgrest>`_ - Python
|
||||||
* `team142/ng-postgrest <https://github.com/team142/ng-postgrest>`_ - Angular app for browsing, editing data exposed over PostgREST.
|
* `redux-postgrest <https://github.com/andytango/redux-postgrest>`_ - TypeScript/JS, client integrated with (React) Redux.
|
||||||
* `andytango/redux-postgrest <https://github.com/andytango/redux-postgrest>`_ - TypeScript/JS, client integrated with (React) Redux.
|
* `vue-postgrest <https://github.com/technowledgy/vue-postgrest>`_ - Vue.js
|
||||||
|
|
||||||
.. _eco_commercial:
|
.. _eco_commercial:
|
||||||
|
|
||||||
|
|||||||
@@ -4,11 +4,11 @@ Casting a type to a custom JSON object
|
|||||||
:author: `steve-chavez <https://github.com/steve-chavez>`_
|
:author: `steve-chavez <https://github.com/steve-chavez>`_
|
||||||
|
|
||||||
While using PostgREST you might have noticed that certain PostgreSQL types translate to JSON strings when you would
|
While using PostgREST you might have noticed that certain PostgreSQL types translate to JSON strings when you would
|
||||||
have expected a JSON object or array. For example, let's see the case of `range types <https://www.postgresql.org/docs/11/rangetypes.html>`_.
|
have expected a JSON object or array. For example, let's see the case of `range types <https://www.postgresql.org/docs/current/rangetypes.html>`_.
|
||||||
|
|
||||||
.. code-block:: postgres
|
.. code-block:: postgres
|
||||||
|
|
||||||
-- example taken from https://www.postgresql.org/docs/11/rangetypes.html#RANGETYPES-EXAMPLES
|
-- example taken from https://www.postgresql.org/docs/current/rangetypes.html#RANGETYPES-EXAMPLES
|
||||||
create table reservations (
|
create table reservations (
|
||||||
room int
|
room int
|
||||||
, during tsrange
|
, during tsrange
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ We can retrieve this image in binary format from our PostgREST API by requesting
|
|||||||
Unfortunately, putting the URL into the :code:`src` of an :code:`<img>` tag will not work.
|
Unfortunately, putting the URL into the :code:`src` of an :code:`<img>` tag will not work.
|
||||||
That's because browsers do not send the required header.
|
That's because browsers do not send the required header.
|
||||||
|
|
||||||
Luckily, we can configure our `Nginx reverse proxy <../admin.html>`_ to fix this problem for us.
|
Luckily, we can configure our :ref:`Nginx reverse proxy <admin>` to fix this problem for us.
|
||||||
We assume that PostgREST is running on port 3000.
|
We assume that PostgREST is running on port 3000.
|
||||||
We provide a new location :code:`/files/` that redirects requests to our endpoint with the :code:`Accept` header set to :code:`application/octet-stream`.
|
We provide a new location :code:`/files/` that redirects requests to our endpoint with the :code:`Accept` header set to :code:`application/octet-stream`.
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ PostgREST Documentation
|
|||||||
.. image:: https://img.shields.io/github/stars/postgrest/postgrest.svg?style=social
|
.. image:: https://img.shields.io/github/stars/postgrest/postgrest.svg?style=social
|
||||||
:target: https://github.com/PostgREST/postgrest
|
:target: https://github.com/PostgREST/postgrest
|
||||||
|
|
||||||
.. image:: https://img.shields.io/github/release/PostgREST/postgrest.svg
|
.. image:: https://img.shields.io/github/v/release/PostgREST/postgrest.svg
|
||||||
:target: https://github.com/PostgREST/postgrest/releases
|
:target: https://github.com/PostgREST/postgrest/releases
|
||||||
|
|
||||||
.. image:: https://img.shields.io/docker/pulls/postgrest/postgrest.svg
|
.. image:: https://img.shields.io/docker/pulls/postgrest/postgrest.svg
|
||||||
@@ -39,11 +39,11 @@ Sponsors
|
|||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
.. image:: _static/retool.png
|
.. image:: _static/retool.png
|
||||||
:target: https://tryretool.com/?utm_source=sponsor&utm_campaign=postgrest
|
:target: https://retool.com/?utm_source=sponsor&utm_campaign=postgrest
|
||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
.. image:: _static/supabase.png
|
.. image:: _static/supabase.png
|
||||||
:target: https://supabase.io?utm_source=postgrest%20backers&utm_medium=open%20source%20partner&utm_campaign=postgrest%20backers%20github&utm_term=homepage
|
:target: https://supabase.io/?utm_source=postgrest%20backers&utm_medium=open%20source%20partner&utm_campaign=postgrest%20backers%20github&utm_term=homepage
|
||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
|
|
|
|
||||||
@@ -71,7 +71,7 @@ PostgREST has a focused scope. It works well with other tools like Nginx. This f
|
|||||||
Getting Support
|
Getting Support
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
The project has a friendly and growing community. Join our `chat room <https://gitter.im/begriffs/postgrest>`_ for discussion and help. You can also report or search for bugs/features on the Github `issues <https://github.com/begriffs/postgrest/issues>`_ page.
|
The project has a friendly and growing community. Join our `chat room <https://gitter.im/begriffs/postgrest>`_ for discussion and help. You can also report or search for bugs/features on the Github `issues <https://github.com/PostgREST/postgrest/issues>`_ page.
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:glob:
|
:glob:
|
||||||
@@ -204,25 +204,21 @@ In Production
|
|||||||
|
|
||||||
Here are some companies that use PostgREST in production.
|
Here are some companies that use PostgREST in production.
|
||||||
|
|
||||||
* `Sompani <https://www.sompani.com/>`_
|
* `Catarse <https://www.catarse.me>`_
|
||||||
* `Datrium <https://www.datrium.com>`_
|
* `Datrium <https://www.datrium.com>`_
|
||||||
* `Supabase <https://supabase.io>`_
|
* `Drip Depot <https://www.dripdepot.com>`_
|
||||||
* `Nimbus <https://nimbusforwork.com/>`_
|
* `eGull <https://www.egull.co>`_
|
||||||
- See how Nimbus uses PostgREST in `Paul Copplestone's blog post <https://paul.copplest.one/blog/nimbus-tech-2019-04.html>`_.
|
|
||||||
* `Catarse <https://www.catarse.me/>`_
|
|
||||||
* `Moat <https://moat.com/>`_
|
|
||||||
* `Netwo <https://www.netwo.io/>`_
|
|
||||||
* `Redsmin <https://www.redsmin.com/>`_
|
|
||||||
* `Image-charts <https://image-charts.com/>`_
|
|
||||||
* `MotionDynamic - Fast highly dynamic video generation at scale <https://api.motiondynamic.tech/>`_
|
|
||||||
* `Drip Depot <https://www.dripdepot.com/>`_
|
|
||||||
* `Convene <https://info.convene.thomsonreuters.com/en.html>`_ by Thomson-Reuters
|
|
||||||
* `eGull <http://www.egull.co>`_
|
|
||||||
* `Elyios <https://elyios.com>`_
|
* `Elyios <https://elyios.com>`_
|
||||||
* `Simply Connected Systems <https://www.simplyconnectedsystems.com/>`_
|
* `Image-charts <https://www.image-charts.com>`_
|
||||||
|
* `Moat <https://moat.com>`_
|
||||||
.. * `OpenBooking <http://openbooking.ch>`_
|
* `MotionDynamic - Fast highly dynamic video generation at scale <https://motiondynamic.tech>`_
|
||||||
.. * `triggerFS - A realtime messaging and distributed trigger system <https://triggerfs.io/>`_
|
* `Netwo <https://www.netwo.io>`_
|
||||||
|
* `Nimbus <https://www.nimbusforwork.com>`_
|
||||||
|
- See how Nimbus uses PostgREST in `Paul Copplestone's blog post <https://paul.copplest.one/blog/nimbus-tech-2019-04.html>`_.
|
||||||
|
* `OpenBooking <https://www.openbooking.ch>`_
|
||||||
|
* `Redsmin <https://www.redsmin.com>`_
|
||||||
|
* `Sompani <https://www.sompani.com>`_
|
||||||
|
* `Supabase <https://supabase.io>`_
|
||||||
|
|
||||||
Testimonials
|
Testimonials
|
||||||
------------
|
------------
|
||||||
@@ -264,11 +260,6 @@ Testimonials
|
|||||||
|
|
||||||
-- Anupam Garg, Datrium, Inc.
|
-- Anupam Garg, Datrium, Inc.
|
||||||
|
|
||||||
Translations
|
|
||||||
------------
|
|
||||||
|
|
||||||
* `Chinese <http://postgrest.org/zh/latest/>`_ (latest version ``v0.4.2.0``)
|
|
||||||
|
|
||||||
Contributing
|
Contributing
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -18,7 +18,7 @@ If you use **FreeBSD**, then you can install PostgREST from the `official ports
|
|||||||
|
|
||||||
pkg install hs-postgrest
|
pkg install hs-postgrest
|
||||||
|
|
||||||
If you use **Arch Linux**, then you can install PostgREST from the `community repo <https://www.archlinux.org/packages/community/x86_64/postgrest>`_.
|
If you use **Arch Linux**, then you can install PostgREST from the `community repo <https://archlinux.org/packages/community/x86_64/postgrest>`_.
|
||||||
|
|
||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
@@ -30,7 +30,7 @@ If you use **Nix**, then you can install PostgREST from nixpkgs.
|
|||||||
|
|
||||||
nix-env -i haskellPackages.postgrest
|
nix-env -i haskellPackages.postgrest
|
||||||
|
|
||||||
If you use Windows, you can install PostgREST using `Chocolatey <https://chocolatey.org/packages/postgrest>`_ or `Scoop <https://scoop.sh>`_.
|
If you use Windows, you can install PostgREST using `Chocolatey <https://community.chocolatey.org/packages/postgrest>`_ or `Scoop <https://scoop.sh>`_.
|
||||||
|
|
||||||
.. code:: bash
|
.. code:: bash
|
||||||
|
|
||||||
@@ -252,7 +252,7 @@ Assuming you're making modifications locally and then pushing to GitHub, it's ea
|
|||||||
|
|
||||||
1. Create a new app on Heroku
|
1. Create a new app on Heroku
|
||||||
2. In Settings add the following buildpack :code:`https://github.com/PostgREST/postgrest-heroku`
|
2. In Settings add the following buildpack :code:`https://github.com/PostgREST/postgrest-heroku`
|
||||||
3. Add the require Config Vars in Heroku (see https://github.com/PostgREST/postgrest/blob/master/app.json#L7-L57 for more details)
|
3. Add the require Config Vars in Heroku (see https://github.com/PostgREST/postgrest/blob/main/app.json for more details)
|
||||||
4. Modify your ``postgrest.conf`` file as required to match your Config Vars in Heroku
|
4. Modify your ``postgrest.conf`` file as required to match your Config Vars in Heroku
|
||||||
5. Create your :code:`Procfile` and add :code:`./env-to-config ./postgrest postgrest.conf`
|
5. Create your :code:`Procfile` and add :code:`./env-to-config ./postgrest postgrest.conf`
|
||||||
6. Push your changes to GitHub
|
6. Push your changes to GitHub
|
||||||
|
|||||||
@@ -25,5 +25,5 @@ Changed
|
|||||||
-------
|
-------
|
||||||
|
|
||||||
* Docker images are now optimized to be built from the scratch image. This reduces the compressed image size from over 30 MB to about 4 MB.
|
* Docker images are now optimized to be built from the scratch image. This reduces the compressed image size from over 30 MB to about 4 MB.
|
||||||
For more details, see `Docker image built with Nix <https://github.com/PostgREST/postgrest/tree/master/nix/docker#docker-image-built-with-nix>`_.
|
For more details, see `Docker image built with Nix <https://github.com/PostgREST/postgrest/tree/main/nix/docker#user-content-docker-image-built-with-nix>`_.
|
||||||
|br| -- `@monacoremo <https://github.com/monacoremo>`_
|
|br| -- `@monacoremo <https://github.com/monacoremo>`_
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
v5.2.0
|
v5.2.0
|
||||||
======
|
======
|
||||||
|
|
||||||
* `Explicit qualification <http://postgrest.org/en/v5.0/api.html#explicit-qualification>`_ introduced in ``v5.0`` is no longer necessary, this section will not be included from this version onwards. A :ref:`db-extra-search-path` configuration parameter was introduced to avoid the need to explictly qualify database objects. If you install PostgreSQL extensions on the ``public`` schema, they'll work normally from now on.
|
* `Explicit qualification <https://postgrest.org/en/v5.0/api.html#explicit-qualification>`_ introduced in ``v5.0`` is no longer necessary, this section will not be included from this version onwards. A :ref:`db-extra-search-path` configuration parameter was introduced to avoid the need to explictly qualify database objects. If you install PostgreSQL extensions on the ``public`` schema, they'll work normally from now on.
|
||||||
|
|
||||||
* Now you can filter :ref:`tabs-cols-w-spaces`.
|
* Now you can filter :ref:`tabs-cols-w-spaces`.
|
||||||
|
|
||||||
@@ -23,4 +23,4 @@ This release was made possible thanks to:
|
|||||||
* Victor Adossi
|
* Victor Adossi
|
||||||
* Petr Beles
|
* Petr Beles
|
||||||
|
|
||||||
If you like to join them please consider `supporting PostgREST development <https://github.com/PostgREST/postgrest#supporting-development>`_.
|
If you like to join them please consider `supporting PostgREST development <https://github.com/PostgREST/postgrest#user-content-supporting-development>`_.
|
||||||
|
|||||||
+3
-3
@@ -13,7 +13,7 @@ Added
|
|||||||
* Ignoring payload keys for insert/update can be now done with the ``?columns`` query parameter. See :ref:`specify_columns`.
|
* Ignoring payload keys for insert/update can be now done with the ``?columns`` query parameter. See :ref:`specify_columns`.
|
||||||
|br| -- `@steve-chavez <https://github.com/steve-chavez>`_
|
|br| -- `@steve-chavez <https://github.com/steve-chavez>`_
|
||||||
|
|
||||||
* `websearch_to_tsquery <https://www.postgresql.org/docs/11/functions-textsearch.html#id-1.5.8.18.8.2.2.7.1.1>`_ can now be used
|
* `websearch_to_tsquery <https://www.postgresql.org/docs/current/functions-textsearch.html#id-1.5.8.19.7.2.2.7.1.1.1>`_ can now be used
|
||||||
through the ``wfts`` operator. See :ref:`fts`.
|
through the ``wfts`` operator. See :ref:`fts`.
|
||||||
|br| -- `@herulume <https://github.com/herulume>`_
|
|br| -- `@herulume <https://github.com/herulume>`_
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ This release is sponsored by:
|
|||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
.. image:: ../_static/retool.png
|
.. image:: ../_static/retool.png
|
||||||
:target: https://tryretool.com/?utm_source=sponsor&utm_campaign=postgrest
|
:target: https://retool.com/?utm_source=sponsor&utm_campaign=postgrest
|
||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
* `Daniel Babiak <https://github.com/dbabiak>`_
|
* `Daniel Babiak <https://github.com/dbabiak>`_
|
||||||
@@ -76,4 +76,4 @@ This release is sponsored by:
|
|||||||
* Christopher Reid
|
* Christopher Reid
|
||||||
* Nathan Bouscal
|
* Nathan Bouscal
|
||||||
|
|
||||||
If you like to join them please consider `supporting PostgREST development <https://github.com/PostgREST/postgrest#supporting-development>`_.
|
If you like to join them please consider `supporting PostgREST development <https://github.com/PostgREST/postgrest#user-content-supporting-development>`_.
|
||||||
|
|||||||
+2
-2
@@ -85,7 +85,7 @@ This release was made possible thanks to:
|
|||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
.. image:: ../_static/retool.png
|
.. image:: ../_static/retool.png
|
||||||
:target: https://tryretool.com/?utm_source=sponsor&utm_campaign=postgrest
|
:target: https://retool.com/?utm_source=sponsor&utm_campaign=postgrest
|
||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
* `Daniel Babiak <https://github.com/dbabiak>`_
|
* `Daniel Babiak <https://github.com/dbabiak>`_
|
||||||
@@ -103,4 +103,4 @@ This release was made possible thanks to:
|
|||||||
* David Fenko
|
* David Fenko
|
||||||
|
|
||||||
|
|
||||||
If you like to join them please consider `supporting PostgREST development <https://github.com/PostgREST/postgrest#supporting-development>`_.
|
If you like to join them please consider `supporting PostgREST development <https://github.com/PostgREST/postgrest#user-content-supporting-development>`_.
|
||||||
|
|||||||
+2
-2
@@ -48,7 +48,7 @@ This release was made possible thanks to:
|
|||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
.. image:: ../_static/retool.png
|
.. image:: ../_static/retool.png
|
||||||
:target: https://tryretool.com/?utm_source=sponsor&utm_campaign=postgrest
|
:target: https://retool.com/?utm_source=sponsor&utm_campaign=postgrest
|
||||||
:width: 13em
|
:width: 13em
|
||||||
|
|
||||||
* `Daniel Babiak <https://github.com/dbabiak>`_
|
* `Daniel Babiak <https://github.com/dbabiak>`_
|
||||||
@@ -66,4 +66,4 @@ This release was made possible thanks to:
|
|||||||
* David Fenko
|
* David Fenko
|
||||||
|
|
||||||
|
|
||||||
If you'd like to join them, consider `supporting PostgREST development <https://github.com/PostgREST/postgrest#supporting-development>`_.
|
If you'd like to join them, consider `supporting PostgREST development <https://github.com/PostgREST/postgrest#user-content-supporting-development>`_.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
Schema Isolation
|
Schema Isolation
|
||||||
================
|
================
|
||||||
|
|
||||||
A PostgREST instance exposes all the tables, views, and stored procedures of a single `PostgreSQL schema <https://www.postgresql.org/docs/12/ddl-schemas.html>`_ (a namespace of database objects). This means private data or implementation details can go inside different private schemas and be invisible to HTTP clients.
|
A PostgREST instance exposes all the tables, views, and stored procedures of a single `PostgreSQL schema <https://www.postgresql.org/docs/current/ddl-schemas.html>`_ (a namespace of database objects). This means private data or implementation details can go inside different private schemas and be invisible to HTTP clients.
|
||||||
|
|
||||||
It is recommended that you don't expose tables on your API schema. Instead expose views and stored procedures which insulate the internal details from the outside world.
|
It is recommended that you don't expose tables on your API schema. Instead expose views and stored procedures which insulate the internal details from the outside world.
|
||||||
This allows you to change the internals of your schema and maintain backwards compatibility. It also keeps your code easier to refactor, and provides a natural way to do API versioning.
|
This allows you to change the internals of your schema and maintain backwards compatibility. It also keeps your code easier to refactor, and provides a natural way to do API versioning.
|
||||||
@@ -20,7 +20,7 @@ This allows you to change the internals of your schema and maintain backwards co
|
|||||||
Functions
|
Functions
|
||||||
=========
|
=========
|
||||||
|
|
||||||
By default, when a function is created, the privilege to execute it is not restricted by role. The function access is ``PUBLIC`` — executable by all roles (more details at `PostgreSQL Privileges page <https://www.postgresql.org/docs/12/ddl-priv.html>`_). This is not ideal for an API schema. To disable this behavior, you can run the following SQL statement:
|
By default, when a function is created, the privilege to execute it is not restricted by role. The function access is ``PUBLIC`` — executable by all roles (more details at `PostgreSQL Privileges page <https://www.postgresql.org/docs/current/ddl-priv.html>`_). This is not ideal for an API schema. To disable this behavior, you can run the following SQL statement:
|
||||||
|
|
||||||
.. code-block:: postgres
|
.. code-block:: postgres
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ This will change the privileges for all functions created in the future in all s
|
|||||||
|
|
||||||
ALTER DEFAULT PRIVILEGES GRANT EXECUTE ON FUNCTIONS TO PUBLIC;
|
ALTER DEFAULT PRIVILEGES GRANT EXECUTE ON FUNCTIONS TO PUBLIC;
|
||||||
|
|
||||||
This will work because the :code:`alter default privileges` statement has effect on function created *after* it is executed. See `PostgreSQL alter default privileges <https://www.postgresql.org/docs/current/static/sql-alterdefaultprivileges.html>`_ for more details.
|
This will work because the :code:`alter default privileges` statement has effect on function created *after* it is executed. See `PostgreSQL alter default privileges <https://www.postgresql.org/docs/current/sql-alterdefaultprivileges.html>`_ for more details.
|
||||||
|
|
||||||
After that, you'll need to grant EXECUTE privileges on functions explicitly:
|
After that, you'll need to grant EXECUTE privileges on functions explicitly:
|
||||||
|
|
||||||
@@ -73,12 +73,12 @@ Another option is to define the function with the :code:`SECURITY DEFINER` optio
|
|||||||
end;
|
end;
|
||||||
$$ language plpgsql security definer;
|
$$ language plpgsql security definer;
|
||||||
|
|
||||||
Note the ``SECURITY DEFINER`` keywords at the end of the function. See `PostgreSQL documentation <https://www.postgresql.org/docs/current/static/sql-createfunction.html#SQL-CREATEFUNCTION-SECURITY>`_ for more details.
|
Note the ``SECURITY DEFINER`` keywords at the end of the function. See `PostgreSQL documentation <https://www.postgresql.org/docs/current/sql-createfunction.html#SQL-CREATEFUNCTION-SECURITY>`_ for more details.
|
||||||
|
|
||||||
Views
|
Views
|
||||||
=====
|
=====
|
||||||
|
|
||||||
Views are invoked with the privileges of the view owner, much like stored procedures with the ``SECURITY DEFINER`` option. When created by a SUPERUSER role, all `row-level security <https://www.postgresql.org/docs/current/static/ddl-rowsecurity.html>`_ will be bypassed unless a different, non-SUPERUSER owner is specified.
|
Views are invoked with the privileges of the view owner, much like stored procedures with the ``SECURITY DEFINER`` option. When created by a SUPERUSER role, all `row-level security <https://www.postgresql.org/docs/current/ddl-rowsecurity.html>`_ will be bypassed unless a different, non-SUPERUSER owner is specified.
|
||||||
|
|
||||||
For changing this, we can create a non-SUPERUSER role and make this role the view's owner.
|
For changing this, we can create a non-SUPERUSER role and make this role the view's owner.
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ For changing this, we can create a non-SUPERUSER role and make this role the vie
|
|||||||
Rules
|
Rules
|
||||||
-----
|
-----
|
||||||
|
|
||||||
Insertion on views with complex `rules <https://www.postgresql.org/docs/11/sql-createrule.html>`_ might not work out of the box with PostgREST.
|
Insertion on views with complex `rules <https://www.postgresql.org/docs/current/sql-createrule.html>`_ might not work out of the box with PostgREST.
|
||||||
It's recommended that you `use triggers instead of rules <https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_rules>`_.
|
It's recommended that you `use triggers instead of rules <https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_rules>`_.
|
||||||
If you want to keep using rules, a workaround is to wrap the view insertion in a stored procedure and call it through the :ref:`s_procs` interface.
|
If you want to keep using rules, a workaround is to wrap the view insertion in a stored procedure and call it through the :ref:`s_procs` interface.
|
||||||
For more details, see this `github issue <https://github.com/PostgREST/postgrest/issues/1283>`_.
|
For more details, see this `github issue <https://github.com/PostgREST/postgrest/issues/1283>`_.
|
||||||
|
|||||||
@@ -13,5 +13,6 @@ pkgs.mkShell {
|
|||||||
docs.serve
|
docs.serve
|
||||||
docs.spellcheck
|
docs.spellcheck
|
||||||
docs.dictcheck
|
docs.dictcheck
|
||||||
|
docs.linkcheck
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -23,9 +23,9 @@ As you begin the tutorial, pop open the project `chat room <https://gitter.im/be
|
|||||||
Step 2. Install PostgreSQL
|
Step 2. Install PostgreSQL
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
If you're already familiar with using PostgreSQL and have it installed on your system you can use the existing installation(see :ref:`pg-dependency` for minimum requirements). For this tutorial we'll describe how to use the database in Docker because database configuration is otherwise too complicated for a simple tutorial.
|
If you're already familiar with using PostgreSQL and have it installed on your system you can use the existing installation (see :ref:`pg-dependency` for minimum requirements). For this tutorial we'll describe how to use the database in Docker because database configuration is otherwise too complicated for a simple tutorial.
|
||||||
|
|
||||||
If Docker is not installed, you can get it `here <https://www.docker.com/community-edition#download>`_. Next, let's pull and start the database image:
|
If Docker is not installed, you can get it `here <https://www.docker.com/get-started>`_. Next, let's pull and start the database image:
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ You should see the psql command prompt:
|
|||||||
|
|
||||||
postgres=#
|
postgres=#
|
||||||
|
|
||||||
The first thing we'll do is create a `named schema <https://www.postgresql.org/docs/current/static/ddl-schemas.html>`_ for the database objects which will be exposed in the API. We can choose any name we like, so how about "api." Execute this and the other SQL statements inside the psql prompt you started.
|
The first thing we'll do is create a `named schema <https://www.postgresql.org/docs/current/ddl-schemas.html>`_ for the database objects which will be exposed in the API. We can choose any name we like, so how about "api." Execute this and the other SQL statements inside the psql prompt you started.
|
||||||
|
|
||||||
.. code-block:: postgres
|
.. code-block:: postgres
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user