Skip site navigation (1) Skip section navigation (2)

Fwd: I would like to alter the COPY command

From: Mason <freemason(at)gmail(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: Fwd: I would like to alter the COPY command
Date: 2006-12-24 03:08:56
Message-ID: 523e84030612231908i5c272b5atabe95643d482e157@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-patchespgsql-sql
What I have is data with two different characters for "start quote"
and "end quote".  In my case it's '[' and ']', but it could be
anything from "smart quotes", to parentheses, to brackets, braces, ^/$
in regexps, etc.  I think this isn't too unreasonable a feature to
have to make copy more functional when importing data that is
difficult to transform properly beforehand (in my case is about half a
terabyte of log files, which takes hours and hours, just to cat, let
alone reparse and dump into COPY).

Now, in my case I can just say "cat file | tr '[]' '""' | psql -f
import.sql", but then I lose the ability for psql to do anything smart
like using mmap (I'm making assumptions that it does anything smart
like that, but even if it doesn't now, it could some day).

So, I'm a passable c/c++ programmer, when I have to be, so
theoretically I can do the work myself, but I have never touched
postgres before, so I don't know where to begin.  Any ideas how to add
this?

In response to

Responses

pgsql-patches by date

Next:From: Bruce MomjianDate: 2006-12-24 06:50:15
Subject: Re: [BUGS] BUG #2846: inconsistent and confusing handling of
Previous:From: MasonDate: 2006-12-24 03:08:24
Subject: I would like to alter the COPY command

pgsql-sql by date

Next:From: Alexis Paul BertoliniDate: 2006-12-24 16:05:37
Subject: Re: Changing character set when the damage is done
Previous:From: MasonDate: 2006-12-24 03:08:24
Subject: I would like to alter the COPY command

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group