Re: [GENERAL] converting E'C:\\something' to bytea

2011-03-16 Thread Tom Lane
Vlad Romascanu writes: > Hi, Tom, > Why does: >CREATE CAST (text AS bytea) WITHOUT FUNCTION; >SELECT E'C:\\something'::text::bytea; > work as expected, but (with the original text->bytea cast in place): >CREATE DOMAIN my_varlena AS text; >CREATE CAST (my_varlena AS bytea) WITHOU

Re: [GENERAL] converting E'C:\\something' to bytea

2011-03-16 Thread Vlad Romascanu
Hi, Tom, Why does: CREATE CAST (text AS bytea) WITHOUT FUNCTION; SELECT E'C:\\something'::text::bytea; work as expected, but (with the original text->bytea cast in place): CREATE DOMAIN my_varlena AS text; CREATE CAST (my_varlena AS bytea) WITHOUT FUNCTION; SELECT E'C:\\something

Re: [GENERAL] converting E'C:\\something' to bytea

2011-03-16 Thread Tom Lane
Bruce Momjian writes: > Vlad Romascanu wrote: >> Is there any way of casting (reinterpreting) a varchar/text field >> containing arbitrary backslashes to bytea without making an escaped >> copy of the varchar/text first? > Well, the '\\' is being converted to '\' because of the single-quotes, > a

Re: [GENERAL] converting E'C:\\something' to bytea

2011-03-16 Thread Vlad Romascanu
Hi, Bruce, Yes, I essentially want to reinterpret text as bytea without any conversion or actual backslash logic coming in the process, in the same way pg_convert_from internally reinterprets the bytea return value from pg_convert as text without any additional logic. I.e. given the text field 'C

Re: [GENERAL] converting E'C:\\something' to bytea

2011-03-16 Thread Bruce Momjian
Vlad Romascanu wrote: > Hello, > > Is there any way of casting (reinterpreting) a varchar/text field > containing arbitrary backslashes to bytea without making an escaped > copy of the varchar/text first? In the examples below I am using a > constant E'...' for clarity, the value normally comes f