I have a log file full of URLs, generated by Bro IDS.
When Bro logs a URL with non-ascii characters in it, it inserts \xYY where YY is the hexadecimal character code. Also, some URLs contain "\x".
Is there a setting or flag I can use with the COPY
or \copy
command to stop postgres from trying to interpret these string sequences and just put them in the text field as is?
Best Answer
The backslash
\
is the default escape character in the (default) text format ofCOPY
. The format you describe is recognized as (quoting the manual here).. which seems to be just as intended.
To avoid this effect you could use the CSV format instead, where the backslash has no special meaning:
Be sure to read the manual to learn about additional differences.
Alternatively you could replace every
\
with\\
in your file with ased
script or something.If the above doesn't solve your problem, please supply:
COPY
toCOPY
invocation you used