这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

(Add entries here in the order of: server, console, cli, docs, others)

- server: add `--pg-connection-options` command-line flag for passing parameters to PostgreSQL (close #5092) (#5187)
- server: improve memory usage of idle websockets connections (#5190)
- server: few relay fixes (fix #5020, #5037, #5046) (#5013)
- server: raise error on startup when `--unauthorized-role` is ignored (#4736)
Expand All @@ -40,6 +41,7 @@
- console: allow configuring session_argument for custom functions (close #4499) (#4922)
- console: fix listen update column config selection for event trigger (close #5042) (#5043)
- cli: add new flags up-sql and down-sql to generate sql based migrations from the CLI (#5026)
- docs: add instructions on fixing loss of data when using floats (close #5092)
- docs: add page on setting up v2 migrations (close #4746) (#4898)

## `v1.3.0-beta.1`
Expand Down
9 changes: 7 additions & 2 deletions docs/graphql/manual/api-reference/postgresql-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ E.g.
}
]

.. note::

To avoid loss of data when retrieving IEEE 754 style data from the database,
please refer to the :ref:`server_flag_reference` for instructions on setting
the ``extra_float_digits`` parameter, which has a bad default value in
PostgreSQL 11 and older.

.. _Numeric:

Numeric
Expand Down Expand Up @@ -327,5 +334,3 @@ E.g. For macaddr type
.. Note::

You can learn more about PostgreSQL data types `here <https://www.postgresql.org/docs/current/static/datatype.html>`__.


Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,23 @@ Or you can specify the following options *(only via flags)*:

.. code-block:: none

--host Postgres server host
-p, --port Postgres server port
-u, --user Database user name
-p, --password Password of the user
-d, --dbname Database name to connect to
--host Postgres server host
-p, --port Postgres server port
-u, --user Database user name
-p, --password Password of the user
-d, --dbname Database name to connect to
-o, --pg-connection-options PostgreSQL connection options

.. note::

The default configuration of PostgreSQL 11 and older may result in loss of
precision when retrieving IEEE 754 style data, such as ``float4``, ``real``
or ``double precision`` values, from the database. To avoid this, set the
``extra_float_digits`` PostgreSQL connection parameter to 3. This can be
done by passing ``'--pg-connection-options=-c extra_float_digits=3'`` to
``graphql-engine``, or by passing this option as part of the database url:

``postgres://admin:mypass@mydomain.com:5432/mydb?options=-c%20extra_float_digits%3D3``

.. _command-flags:

Expand Down
10 changes: 9 additions & 1 deletion server/src-lib/Hasura/Server/Init.hs
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ adminInternalErrorsEnv =
parseRawConnInfo :: Parser RawConnInfo
parseRawConnInfo =
RawConnInfo <$> host <*> port <*> user <*> password
<*> dbUrl <*> dbName <*> pure Nothing
<*> dbUrl <*> dbName <*> options
<*> retries
where
host = optional $
Expand Down Expand Up @@ -532,6 +532,14 @@ parseRawConnInfo =
metavar "<DBNAME>" <>
help "Database name to connect to"
)

options = optional $
strOption ( long "pg-connection-options" <>
short 'o' <>
metavar "<DATABASE-OPTIONS>" <>
help "PostgreSQL options"
)

retries = optional $
option auto ( long "retries" <>
metavar "NO OF RETRIES" <>
Expand Down