Open rolivares opened 3 months ago
Similar issue here:
string query = "payload_json-> 'bid_TimeSeries' @> '[{\"flowDirectiondirection\":\"A02\"}]'";
q.WhereRaw(query);
I get the following SQL generated for postgres
WHERE payload_json-> 'bid_TimeSeries' @> '"""flowDirectiondirection":"A02"""'
but the expected output is
WHERE payload_json -> 'bid_TimeSeries' @> '[{"flowDirectiondirection":"A01"}]'
UPDATE:
was able to resolve this by using convention to escape [,],{,} charactes required by SqlKata like this
string jquery = $"payload_json -> 'bid_TimeSeries' @> '\\[\\{{\"flowDirectiondirection\":\"{item}\"\\}}\\]'";
(note the escaping of the backslash and escaping the special characters)
In order to get this sentence using WhereRaw:
I've used this string as raw sentence:
I'm getting this expression (note the replace chars near E '"\n\r"+', '', 'g') )
If you compare results using MSSql and postgresql factory are different on chars "[" and "]".
How can I escape or acomplish the statement: E'[\n\r]+'
Thanks
UPDATE: note the space after "E" on expression => E '"\n\r"+', '', 'g') this is addded qhen symbol "[" is replaced When I've try to escape the symbols with "\" that space continues appearing in consequence SQL does not work