Re: Import SVG file - Mailing list pgsql-general

From Phil Endecott
Subject Re: Import SVG file
Date
Msg-id 41FFB2CA.2070704@chezphil.org
Whole thread Raw
In response to Import SVG file  (Miguel Angel Tribaldos Hervas <mitriher@teleco.upv.es>)
Responses Re: Import SVG file  (Alvaro Herrera <alvherre@dcc.uchile.cl>)
List 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.


pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: PostgreSQL Security Release
Next
From: Alvaro Herrera
Date:
Subject: Re: Import SVG file