Skip to content

Postgresql: parsing errors are not propagated to the postgres layer (it was "Postgresql string escaping") #677

@docbacardi

Description

@docbacardi

ArcadeDB Version: 22.11.1

JDK Version: openjdk version "11.0.17" 2022-10-18

OS: Ubuntu 22.04.1 LTS

Expected behavior

I'm trying to escape a single quote in a string enclosed in single quotes using the Postgres interface.
Which MAGIC in SELECT 'abc MAGIC def' will produce the output abc ' def?

chicken@asteroid:~$ psql --host=localhost testdatabase root
Password for user root: 
psql (14.5 (Ubuntu 14.5-0ubuntu0.22.04.1), server 10.5)
Type "help" for help.

testdatabase=> SELECT 'abc MAGIC def';
 'abc MAGIC def' 
-----------------
 abc ' def
(1 row)

It would be great to get something universal not limited to single quotes.

Actual behavior

The straight forward approach \' throws an error.
Postgres has escape strings (E'abc \' def') : https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-BACKSLASH-TABLE . Especially the hexadecimal byte values (\xhh) would be useful to escape anything.

Steps to reproduce

Connect to ArcadeDB with the psql client and run SELECT 'abc \' def':

chicken@asteroid:~$ psql --host=localhost testdatabase root
Password for user root: 
psql (14.5 (Ubuntu 14.5-0ubuntu0.22.04.1), server 10.5)
Type "help" for help.

testdatabase=> SELECT 'abc \' def';
ERROR:  Syntax error on executing query: Encountered " <IDENTIFIER> "def "" at line 1, column 16.
Was expecting one of:
    <EOF> 
    <LIMIT> ...
    <SKIP2> ...
    <OFFSET> ...
    <TIMEOUT> ...
    <AS> ...
    <LET> ...
    <UNWIND> ...
    ";" ...
    "," ...
...

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions