How to use capture groups in a regex in Data explorer?

I get an error when I try to use capture groups with a question mark (...)?. For example:

select p.raw 
from posts p 
where p.raw ~* '^(muchas )?gracias$' 
limit 1;

This is the error:

ActiveRecord::PreparedStatementInvalid: wrong number of bind variables (1 for 2) in: /*
 * DataExplorer Query
 * Query: /admin/plugins/explorer?id=12
 * Started by: nacho
 */
WITH query AS (
select p.raw from posts p where p.raw ~* '^(muchas )?gracias$' limit 1
) SELECT * FROM query
LIMIT 1000

This works perfectly when querying the DB directly. Is there a way to bypass this in Data Explorer?

2 « J'aime »

Désolé pour ma réponse tardive. Votre sujet est apparu lorsque j’ai recherché le message d’erreur que vous avez signalé.

Je travaillais récemment sur un problème similaire. Étrangement, la requête peut être exécutée dans l’explorateur de données si le commentaire suivant est ajouté : /*:0*/. Par exemple :

select p.raw 
from posts p 
where p.raw ~* '^(muchas )?gracias$' 
limit 1

/*:0*/
4 « J'aime »