query-builder icon indicating copy to clipboard operation
query-builder copied to clipboard

Escaping quotes in PostgreSQL

Open vladfaust opened this issue 8 years ago • 3 comments

Currently escape method replaces single quotes with pre-double-slashed-single-quotes (' becomes \\'). This wouldn't work in PostgreSQL, it doesn't like slashes in strings.

The possible solution is to allow to define the escape character to a developer. Again, Tren currently allows it.

vladfaust avatar Jul 18 '17 21:07 vladfaust

I've made updates, you can test. (for example) Can you report if there's a problem?

izniburak avatar Jul 19 '17 00:07 izniburak

You're escaping slashes in PostgreSQL queries - this is overhead due to wrapping in quotes ('value') automatically escapes everything rather than single quotes :nerd_face: For example, 'foo \bar' is a valid string and 'foo'bar' is not. Maybe add a sort of @escapeable_regex thing? For PostgreSQL it would be /'/.

vladfaust avatar Jul 19 '17 00:07 vladfaust

You're right. I'm working on to this. I'll release update coming soon.

izniburak avatar Jul 30 '17 12:07 izniburak