Re: Import SVG file

From: Phil Endecott <spam_from_postgresql_general(at)chezphil(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Import SVG file
Date: 2005-02-01 16:48:10
Message-ID: 41FFB2CA.2070704@chezphil.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Miguel,

> how can I import a SVG file to a row?? The main problem is
> that it has many postgres scape symbols. Can I use the
> 'text' type for that?

I would probably choose to use 'bytea' rather than 'text' because of the
character set issues. The SVG, being XML, describes its own character
set in its header. If you have an 8859-1 database and then import a
UTF-8 SVG file into a text field you will have unnecessary problems.
bytea is just a sequence of bytes.

The main disadvantage of bytea is that you can't do regular expression
searches on them.

> Have I to do some byte-stuffing before the import?

Yes, you will have to do the necessary escaping. I think that the
postgres C library has code to do this, and others have mentioned the
possibilities with other languages. You cannot do it with anything
quite as simple as the one line of psql that you posted.

Regards,

--Phil Endecott.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2005-02-01 17:33:16 Re: Import SVG file
Previous Message Richard Huxton 2005-02-01 14:29:21 Re: PostgreSQL Security Release