Re: Using COPY - Mailing list pgsql-general

From Peter Darley
Subject Re: Using COPY
Date
Msg-id NNEAICKPNOGDBHNCEDCPEEKDCIAA.pdarley@kinesis-cem.com
Whole thread Raw
In response to Re: Using COPY  ("Joel Burton" <joel@joelburton.com>)
Responses Re: Using COPY
List pgsql-general
Joel,
    Darn, I was hoping it was possible to do it with just SQL. :)
Thanks,
Peter Darley

-----Original Message-----
From: Joel Burton [mailto:joel@joelburton.com]
Sent: Tuesday, May 14, 2002 3:11 PM
To: Peter Darley
Cc: pgsql-general@postgresql.org
Subject: RE: [GENERAL] Using COPY

create function fix_marker(text) returns text as '
  $_ = shift;
  s/@@~@@/\\n/;
  return $_;
' language 'plperl';

update tblFoo set foo=fix_marker(foo) where foo like '%@@~@@%';

would do nicely. Or you could do it in plpython, plruby (if installed), or
plperl.

You could do it in plpgsql with a combination of ugly left || right with
strpos, but it's a lot easier in languages that have string-replace
functions.

- J.

Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton
Knowledge Management & Technology Consultant


pgsql-general by date:

Previous
From: "Joel Burton"
Date:
Subject: Re: Using COPY
Next
From: Laurette Cisneros
Date:
Subject: pgaccess schema question