[MonetDB-users] Bulk-importing boolean columns

Viktor Rosenfeld listuser36 at googlemail.com
Tue Oct 18 17:57:23 CEST 2011


Hi,

Martin Kersten wrote:

> On 10/17/11 8:25 PM, Viktor Rosenfeld wrote:
> > Hi,
> >
> > I need to bulk-import data that was bulk-exported from PostgreSQL. I
> > have only limited control over the raw data.
> >
> > I'm using the following command:
> >
> >    COPY INTO table FROM '/path/to/filename' USING DELIMITERS '\t','\n','';
> >
> > This generally works. The problem is boolean data which is exported by
> > PostgreSQL using the values "t" and "f" (unquoted). MonetDB expects
> > "true" and "false" here. My current work-around is opening the file in
> > Vim and substituting the values (%s/\tt\t/\ttrue\t/g and
> > %s/\tf\t/\tfalse\t/g).
> >
> > Is there a way to make MonetDB accept the original PostgreSQL data?
> The easiest solution would be to convert the "t" to "true" before it leaves Postgresql.

I can do that for those tables I export myself, but I also have a few
that I receive from others.

> Otherwise, you might use the stream editor "sed" or "awk" to make such trivial changes.

This would work, but I'm afraid that it changes data it's not supposed
to.

Cheers,
Viktor




More information about the users-list mailing list