oguimbal / pg-mem

An in memory postgres DB instance for your unit tests
MIT License
1.98k stars 97 forks source link

Multidimensional arrays parsing error #79

Open rrichardson opened 3 years ago

rrichardson commented 3 years ago

This statement works in postgres 9.3+

update users set roles = ARRAY[['owner', 'user', users_b.gen_id] from users as users_b where users.id = users_b.id; 

However, this results in a parsing error at the second open bracket:

update users set roles = ARRAY[ [
                                  ^
Unexpected lbracket token: "[". Instead, I was expecting to see one of the following:

    - A "rbracket" token
    - A "star" token
   ...

This looks like it was supposed to be fixed in 1.6.1 (https://github.com/oguimbal/pg-mem/issues/50) so it might be a regression.

Unfortunately I can't work around it with array literal syntax, since I need to dynamically assign a variable in the array.

oguimbal commented 3 years ago

Hi !

Nope, the issue you are refering to is not about parsing multidimentional arrays (nor parsing literals, for that matter). Thanks to have checked for duplicate though :)

I'm a bit busy this week, but I will fix it asap. Thanks for the report.

KunalAdu commented 1 year ago

@rrichardson / @oguimbal : Any update for this as we are still facing issue with substring(_id :: text from 3):: uuid ::text = any ( ARRAY[ARRAY['a521ce02-ecc9-4bb2-9578-d422a7b85a33']]:: text[]); failing with below error : 'Cannot be evaluated as constant\n\nšŸ’„ This is a nasty error, which was unexpected by pg-mem. Also known "a bug" šŸ˜ Please file an issue !\n\nļøāƒ£ Failed SQL statement: 'QueryFailedError: Cannot be evaluated as constant\n\nšŸ’„ This is a nasty error, which was unexpected by pg-mem. Also known "a bug" šŸ˜ Please file an issue !\n\nļøāƒ£ Failed SQL statement: