mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Support hex-string input and output for type BYTEA.
Both hex format and the traditional "escape" format are automatically handled on input. The output format is selected by the new GUC variable bytea_output. As committed, bytea_output defaults to HEX, which is an *incompatible change*. We will keep it this way for awhile for testing purposes, but should consider whether to switch to the more backwards-compatible default of ESCAPE before 8.5 is released. Peter Eisentraut
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
--
|
||||
-- create user defined conversion
|
||||
--
|
||||
|
||||
@@ -43,6 +43,27 @@ SELECT U&'wrong: +0061' UESCAPE '+';
|
||||
|
||||
RESET standard_conforming_strings;
|
||||
|
||||
-- bytea
|
||||
SET bytea_output TO hex;
|
||||
SELECT E'\\xDeAdBeEf'::bytea;
|
||||
SELECT E'\\x De Ad Be Ef '::bytea;
|
||||
SELECT E'\\xDeAdBeE'::bytea;
|
||||
SELECT E'\\xDeAdBeEx'::bytea;
|
||||
SELECT E'\\xDe00BeEf'::bytea;
|
||||
SELECT E'DeAdBeEf'::bytea;
|
||||
SELECT E'De\\000dBeEf'::bytea;
|
||||
SELECT E'De\123dBeEf'::bytea;
|
||||
SELECT E'De\\123dBeEf'::bytea;
|
||||
SELECT E'De\\678dBeEf'::bytea;
|
||||
|
||||
SET bytea_output TO escape;
|
||||
SELECT E'\\xDeAdBeEf'::bytea;
|
||||
SELECT E'\\x De Ad Be Ef '::bytea;
|
||||
SELECT E'\\xDe00BeEf'::bytea;
|
||||
SELECT E'DeAdBeEf'::bytea;
|
||||
SELECT E'De\\000dBeEf'::bytea;
|
||||
SELECT E'De\\123dBeEf'::bytea;
|
||||
|
||||
--
|
||||
-- test conversions between various string types
|
||||
-- E021-10 implicit casting among the character data types
|
||||
|
||||
Reference in New Issue
Block a user