mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Disable the use of Unicode escapes in string constants (U&'') when
standard_conforming_strings is not on, for security reasons.
This commit is contained in:
@@ -17,13 +17,32 @@ SELECT 'first line'
|
||||
AS "Illegal comment within continuation";
|
||||
|
||||
-- Unicode escapes
|
||||
SET standard_conforming_strings TO on;
|
||||
|
||||
SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
|
||||
SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
|
||||
|
||||
SELECT U&' \' UESCAPE '!' AS "tricky";
|
||||
SELECT 'tricky' AS U&"\" UESCAPE '!';
|
||||
|
||||
SELECT U&'wrong: \061';
|
||||
SELECT U&'wrong: \+0061';
|
||||
SELECT U&'wrong: +0061' UESCAPE '+';
|
||||
|
||||
SET standard_conforming_strings TO off;
|
||||
|
||||
SELECT U&'d\0061t\+000061' AS U&"d\0061t\+000061";
|
||||
SELECT U&'d!0061t\+000061' UESCAPE '!' AS U&"d*0061t\+000061" UESCAPE '*';
|
||||
|
||||
SELECT U&' \' UESCAPE '!' AS "tricky";
|
||||
SELECT 'tricky' AS U&"\" UESCAPE '!';
|
||||
|
||||
SELECT U&'wrong: \061';
|
||||
SELECT U&'wrong: \+0061';
|
||||
SELECT U&'wrong: +0061' UESCAPE '+';
|
||||
|
||||
RESET standard_conforming_strings;
|
||||
|
||||
--
|
||||
-- test conversions between various string types
|
||||
-- E021-10 implicit casting among the character data types
|
||||
|
||||
Reference in New Issue
Block a user