pg_duckdb icon indicating copy to clipboard operation
pg_duckdb copied to clipboard

`standards_conforming_strings=off` confuses duckdb parser

Open hlinnaka opened this issue 1 year ago • 2 comments

postgres=# set standard_conforming_strings =off;
SET
postgres=# select * from foo where t = 'foo\'bar';
WARNING:  nonstandard use of \' in a string literal
LINE 1: select * from foo where t = 'foo\'bar';
                                    ^
HINT:  Use '' to write quotes in strings, or use the escape string syntax (E'...').
WARNING:  (DuckDB) Parser Error: syntax error at or near "bar"
LINE 1: select * from foo where t = 'foo\'bar';
                                          ^
ERROR:  unrecognized node type: 1

hlinnaka avatar Aug 14 '24 08:08 hlinnaka

@wuputah @hlinnaka What do you think the best way to fix this issue?

  1. support standards_conforming_strings in duckdb for compatible. -> I see tThe purpose of this guc is to be compatible with the behavior of old versions of postgres. Maybe it's not good idea to do this.
  2. handle this logic in the pg_duckdb. Do some pre-process in the pg_duckdb.
  3. forbid to use the duckdb when we find we use this GUC.

A general question is what is the general approach for some GUCs that may change behavior or be incompatible with duckdb, or is it handled on a case-by-case?

Reminiscent avatar Aug 17 '24 08:08 Reminiscent

This is now fixed by #130, I now added a test for this in #135

JelteF avatar Aug 19 '24 09:08 JelteF