Re: pgsql vs mysql - escaping data for COPY?

From: Alban Hertroys <alban(at)magproductions(dot)nl>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: "howachen(at)gmail(dot)com" <howachen(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: pgsql vs mysql - escaping data for COPY?
Date: 2006-07-03 15:43:53
Message-ID: 44A93B39.8010001@magproductions.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Merlin Moncure wrote:

> * mysql has a few features here and there which are nice...just to
> name a few, flush tables with lock, multiple insert, etc

PostgreSQL does have multiple inserts, but complying to the SQL92
standard, through INSERT (...) SELECT ...
For example:
INSERT INTO my_table (id, name)
SELECT 1, 'John'
UNION ALL SELECT 2, 'Hank'
UNION ALL SELECT 3, 'Charles";

Just to mention that is _is_ possible, just not very pretty.

Next to that, there's the COPY statement of course, with which you can
insert a whole bunch of (properly escaped) data from STDIN.

Now that I think of it... Is there an easy way to escape data for use
with COPY? I know the PQEscapeConnection functions and the like, but
that's a different escaping... I suppose through pg_dump some
functionality might be available to do so...?

It'd be ideal for my case if it'd be possible to do the escaping from
within an XSLT sheet, but that seems unlikely. Can't hurt to ask though ;)

Regards,
--
Alban Hertroys
alban(at)magproductions(dot)nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
7500 AK Enschede

// Integrate Your World //

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jacob Coby 2006-07-03 15:52:17 Re: autovacuum template0
Previous Message Robert Treat 2006-07-03 15:35:39 Re: [GENERAL] Notes on converting from MySQL 5.0.x to PostgreSQL 8.1.4