rum icon indicating copy to clipboard operation
rum copied to clipboard

ERROR: array must not contain nulls

Open ArturFormella opened this issue 5 years ago • 2 comments

Hello! RUM extension works as expected until today. All queries stop working because of NULL in data and in JOIN clause (req.allowed_in_country set to NULL in one row).

ERROR: array must not contain nulls

SQL fragment: LEFT JOIN "context_country_visitor" cv ON (array[req.allowed_in_country] && cv.countries)

My first approach doesn't work (the same error)

LEFT JOIN "context_country_visitor" cv ON (req.allowed_in_country is not null AND array[req.allowed_in_country] && cv.countries) How to force not to assign any row from context_country_visitor if allowed_in_country is NULL without error?

Index definition: CREATE INDEX context_country_visitor_countries ON "context_country_visitor" USING rum (countries rum_anyarray_ops);

Types:

req.allowed_in_country character varying;
cv.countries character varying[];

Thanks!

ArturFormella avatar May 08 '19 21:05 ArturFormella

It is worth saying that without an index all queries work as expected

ArturFormella avatar May 08 '19 22:05 ArturFormella

Hello Artur, Thank you for the issue! Can you send versions of RUM and PostgreSQL? Array support was added in 1.2.0 version. And this check for NULL values within array was there. And I see this error "array must not contain nulls" with pg 10.0 and RUM 1.2.0. For example:

=# SELECT * FROM test_array WHERE i && '{NULL}';
ERROR:  array must not contain nulls

za-arthur avatar May 09 '19 20:05 za-arthur