Re: CopyReadLineText optimization revisited - Mailing list pgsql-hackers

From Dimitri Fontaine
Subject Re: CopyReadLineText optimization revisited
Date
Msg-id m2lj7s3u2s.fsf@hi-media.com
Whole thread Raw
In response to Re: CopyReadLineText optimization revisited  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Ok. If we have to, we can keep that, it just requires more
> programming. After searching for a \n, we can peek at the previous byte to
> check if it's a backslash (and if it is, the one before that to see if it's
> a backslash too, and so forth until we find a non-backslash).

That's what pgloader does to allow for non-quoted fields containing
escaped separator in some contrived input formats (UNLOAD from Informix,
I'm looking at you).

I guess the same kind of playing could be applied to CSV too, but it'd
be necessary to search back to the previous \n and count the QUOTE chars
you find. Which does not sound like a huge win, even if you remember the
state at the last quoted \n.

Fancy format parsing ain't fun.

Regards,
-- 
dim


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: pg_subtrans keeps bloating up in the standby
Next
From: Tom Lane
Date:
Subject: Re: pg_subtrans keeps bloating up in the standby