Postgres filters use incorrect escape characters
- Dominant language
- Rust
- Stars
- 20.8k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 181
Description
**Describe the bug**
In the postgres driver (newest - v1.3.72,, with Postgres 16.9) when using filters like contains or equals, the SQL is generated with `ESCAPE '\\'` . This results in an error:
```
"error": "Error: syntax error at or near \")\"\n
```
It seems that this is because there should be a single backslash.
**To Reproduce**
Steps to reproduce the behavior:
Create a postgres cube and execute a query using a contains filter.
**Expected behavior**
A clear and concise description of what you expected to happen.
We should be able to use contains/equals filters on a postgres connection.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Minimally reproducible Cube Schema**
In case your bug report is data modelling related please put your minimally reproducible Cube Schema here.
You can use selects without tables in order to achieve that as follows.
```javascript
cube(`Users`, {
sql: `
SELECT 1 as id, 'john.doe@example.com' as email
UNION ALL
SELECT 2 as id, 'jane.smith@example.com' as email
`,
dimensions: {
email: {
sql: `email`,
type: `string`
}
},
measures: {
count: {
type: `count`
}
}
});
```
And then query with:
```
{
"dimensions": ["Users.email"],
"filters": [{
"member": "Users.email",
"operator": "contains",
"values": ["example"]
}]
}
```
**Version:**
Using `1.3.72` for the server/core/postgres-driver with Postgres 16.9
**Additional context**
Add any other context about the problem here.
Contributor guide
Assessment
This issue has not been assessed yet.