Re: SQL syntax highlightning don't work for single backslash '\'

From: <mammoth(dot)power(at)gmx(dot)us>
To: "'Melvin Davidson'" <melvin6925(at)yahoo(dot)com>, <pgadmin-support(at)postgresql(dot)org>
Subject: Re: SQL syntax highlightning don't work for single backslash '\'
Date: 2017-05-22 19:52:05
Message-ID: 002e01d2d334$e3d06050$ab7120f0$@gmx.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support

Thanks for the info, I will correct my statements.

I have reported it, because syntax highlighting in pgAdmin 3 was able to show it even with single backslash and PostgreSQL returns it visually correct.

Result: solved

Von: Melvin Davidson [mailto:melvin6925(at)yahoo(dot)com]
Gesendet: Montag, 22. Mai 2017 21:39
An: mammoth(dot)power(at)gmx(dot)us; pgadmin-support(at)postgresql(dot)org
Betreff: Re: [pgadmin-support] SQL syntax highlightning don't work for single backslash '\'

>When I have somewhere in text value single backslash char, then everything behind this char will not be highlighted correct.

<https://www.postgresql.org/docs/9.4/static/functions-matching.html#POSIX-ESCAPE-SEQUENCES>

That is because the Backslash is an ESCAPE character, so you must ESCAPE it and use two backslashes if you want it to be interpreted

as a literal.

Also, do not forget to enclose your strings in quotes!

IE:

SELECT 'a' || E'\\' || 'b'
UNION ALL
SELECT 'c' || E'\\' || 'd';

<https://www.postgresql.org/docs/9.4/static/functions-matching.html#POSIX-ESCAPE-SEQUENCES>

https://www.postgresql.org/docs/9.4/static/functions-matching.html#POSIX-ESCAPE-SEQUENCES

Melvin Davidson 🎸
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you. Das Bild wurde vom Absender entfernt.
www.youtube.com/unusedhero/videos
Folk Alley - All Folk - 24 Hours a day
www.folkalley.com

_____

From: "mammoth(dot)power(at)gmx(dot)us" <mammoth(dot)power(at)gmx(dot)us>
To: pgadmin-support(at)postgresql(dot)org
Sent: Monday, May 22, 2017 3:17 PM
Subject: [pgadmin-support] SQL syntax highlightning don't work for single backslash '\'

When I have somewhere in text value single backslash char, then everything behind this char will not be highlighted correct.

Simple example 1:

SELECT '\';

Simple example 2:

-- Test 1

SELECT a || '\' || b

UNION ALL

-- Test 2

SELECT c || '\' || d;

Screenshots of syntax highlighting:

Single backslash:

Dual backslash:

pgAdmin 4 v1.5

Desktop Runtime

Windows 10 x64 1511

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message David G. Johnston 2017-05-22 19:54:09 Re: SQL syntax highlightning don't work for single backslash '\'
Previous Message Melvin Davidson 2017-05-22 19:38:43 Re: SQL syntax highlightning don't work for single backslash '\'