Re: [HACKERS] Invalid unicode in COPY problem - Mailing list pgsql-general

From John Hansen
Subject Re: [HACKERS] Invalid unicode in COPY problem
Date
Msg-id 5066E5A966339E42AA04BA10BA706AE50A930D@rodrick.geeknet.com.au
Whole thread Raw
List pgsql-general
Madison Kelly wrote:
>    Under most circumstances I would agree with you completely. In my
> case though I have to decide between risking a loss of a
> user's data or
> attempt to store the file name in some manner that would
> return the same
> name used by the file system.
>
>    The user (or one of his/her users in the case of an admin) may be
> completely unaware of the file name being an invalid unicode
> name. The
> file itself though may still be quite valid and contain information
> worthy of backing up. I could notify the user/admin that the
> name is not
> valid but there is no way I could rely on the name being
> changed. Given
> the choices, I would prefer to attempt to store/use the file
> name with
> the invalid unicode character than simply ignore the file.
>
>    Is there a way to store the name in raw binary? If so,
> would this not
> be safe because to postgresql it should no longer matter what
> data is or
> represents, right? Maybe there is a third option I am not yet
> concidering?

Set the client_encoding to ascii when storing that name, and again when
retrieving it.
Or, use a bytea column.

>
> Madison

... John

pgsql-general by date:

Previous
From: Madison Kelly
Date:
Subject: Re: [HACKERS] Invalid unicode in COPY problem
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Invalid unicode in COPY problem