Обсуждение: [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

Re: [pgadmin-support] SQL syntax highlightning don't work for single backslash '\'

От
Melvin Davidson
Дата:
>When I have somewhere in text value single backslash char, then everything behind this char will not be highlighted correct.

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';

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




From: "mammoth.power@gmx.us" <mammoth.power@gmx.us>
To: pgadmin-support@postgresql.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


Вложения

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@yahoo.com]
Gesendet: Montag, 22. Mai 2017 21:39
An: mammoth.power@gmx.us; pgadmin-support@postgresql.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.


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';


 

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.power@gmx.us" <mammoth.power@gmx.us>
To: pgadmin-support@postgresql.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

 

Re: [pgadmin-support] SQL syntax highlightning don't work for singlebackslash '\'

От
"David G. Johnston"
Дата:
On Monday, May 22, 2017, Melvin Davidson <melvin6925@yahoo.com> wrote:
>When I have somewhere in text value single backslash char, then everything behind this char will not be highlighted correct.

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.

Unless you omit the E prefix on the string literal, which the OP did.

David J.

Re: [pgadmin-support] SQL syntax highlightning don't work forsingle backslash '\'

От
Melvin Davidson
Дата:
>Unless you omit the E prefix on the string literal, which the OP did.

Nope! That results in 'a//b' but the op wants 'a/b';
Hence the need to Escape.

Melvin Davidson 🎸
    Cell 720-320-0155
I reserve the right to fantasize.  Whether or not you
wish to share my fantasy is entirely up to you.
www.youtube.com/unusedhero/videos
Folk Alley - All Folk - 24 Hours a day
www.folkalley.com




From: David G. Johnston <david.g.johnston@gmail.com>
To: Melvin Davidson <melvin6925@yahoo.com>
Cc: "mammoth.power@gmx.us" <mammoth.power@gmx.us>; "pgadmin-support@postgresql.org" <pgadmin-support@postgresql.org>
Sent: Monday, May 22, 2017 3:54 PM
Subject: Re: [pgadmin-support] SQL syntax highlightning don't work for single backslash '\'

On Monday, May 22, 2017, Melvin Davidson <melvin6925@yahoo.com> wrote:

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

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.

Unless you omit the E prefix on the string literal, which the OP did.

David J.


Re: [pgadmin-support] SQL syntax highlightning don't work for singlebackslash '\'

От
"David G. Johnston"
Дата:
On Monday, May 22, 2017, Melvin Davidson <melvin6925@yahoo.com> wrote:
>Unless you omit the E prefix on the string literal, which the OP did.

Nope! That results in 'a//b' but the op wants 'a/b';
Hence the need to Escape.

PgAdmin is buggy if it doesn't know that there is no output difference between E'a\\b'  and 'a\b' and thus should disable string colors subsequent to either.

David J.