From d0a2bedbb6e968d8ee0ae8d7b9c00dbc86fd8142 Mon Sep 17 00:00:00 2001 From: Phil Date: Sat, 1 Jul 2017 15:39:34 -0700 Subject: [PATCH 1/2] Add note about dealing with `DISTINCT` and PostgreSQL `json` columns. --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 829b079..20411d9 100644 --- a/README.md +++ b/README.md @@ -492,6 +492,14 @@ def index end ``` +#### `PG::UndefinedFunction: ERROR: could not identify an equality operator for type json` + +If you get the above error while using `distinct: true` that means that +one of the columns that Ransack is selecting is a `json` column. +PostgreSQL does not provide comparison operators for the `json` type. While +it is possible to work around this, in practice it's much better to convert those +to `jsonb`, as [recommended by the PostgreSQL documentation](https://www.postgresql.org/docs/9.6/static/datatype-json.html) + ### Authorization (whitelisting/blacklisting) By default, searching and sorting are authorized on any column of your model From c30355a87cd18135d6660d5c5db9bee2667d81cb Mon Sep 17 00:00:00 2001 From: Phil Date: Sat, 1 Jul 2017 15:39:55 -0700 Subject: [PATCH 2/2] Add a missing period --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 20411d9..f931a9f 100644 --- a/README.md +++ b/README.md @@ -498,7 +498,7 @@ If you get the above error while using `distinct: true` that means that one of the columns that Ransack is selecting is a `json` column. PostgreSQL does not provide comparison operators for the `json` type. While it is possible to work around this, in practice it's much better to convert those -to `jsonb`, as [recommended by the PostgreSQL documentation](https://www.postgresql.org/docs/9.6/static/datatype-json.html) +to `jsonb`, as [recommended by the PostgreSQL documentation](https://www.postgresql.org/docs/9.6/static/datatype-json.html). ### Authorization (whitelisting/blacklisting)