MaterializeInc / materialize

The Cloud Operational Data Store: use SQL to transform, deliver, and act on fast-changing data.
https://materialize.com
Other
5.72k stars 466 forks source link

Postgres inconsistency: regexp_split_to_table: difference with case-insensitivity flag #29413

Open nrainer-materialize opened 1 week ago

nrainer-materialize commented 1 week ago
DROP TABLE IF EXISTS evaluation_0;
CREATE TABLE evaluation_0 (row_index INT, text_val TEXT);
INSERT INTO evaluation_0 VALUES (4, '0*a*B_c-dE.$=#(%)?!'::TEXT);
INSERT INTO evaluation_0 VALUES (5, 'ff00aa'::TEXT);
INSERT INTO evaluation_0 VALUES (9, 'xAAx'::TEXT);

SELECT
  regexp_split_to_table(text_val, 'A+', 'i')
FROM
  evaluation_0
WHERE (row_index IN (4, 5, 9))
ORDER BY row_index ASC
OFFSET 3;

Postgres

 regexp_split_to_table 
-----------------------

 x
 x
(3 rows)

mz

 regexp_split_to_table 
-----------------------
 ff00
 x
 x
(3 rows)
nrainer-materialize commented 6 days ago

This is caused by the OFFSET in combination with a different ordering. It is not possible to specify the order in Postgres (ERROR: table functions are not allowed in ORDER BY clause (function pg_catalog.regexp_split_to_table)).