Unix Technical Forum

Re: [PATCHES] CopyReadLineText optimization

This is a discussion on Re: [PATCHES] CopyReadLineText optimization within the pgsql Hackers forums, part of the PostgreSQL category; --> Heikki Linnakangas wrote: > 1. CopyReadLineText is all about finding the the next end of line; > splitting to ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 11:48 PM
Heikki Linnakangas
 
Posts: n/a
Default Re: [PATCHES] CopyReadLineText optimization

Heikki Linnakangas wrote:
> 1. CopyReadLineText is all about finding the the next end of line;
> splitting to fields is done later. We therefore only care about quotes
> and escapes when they affect the end of line detection. In text mode, we
> only need to care about a backslash that precedes a LF/CR. Therefore,
> we could search for the next LF/CR character with memchr(), and check if
> the preceding character is a backslash (and if it is, check if there's
> yet another backslash behind it, and so forth until we hit a
> non-backslash character).


While looking into this, I realized that we also need to detect the
end-of-copy marker, backslash+period+EOL. In CSV mode, we only honor the
end-of-copy marker if it's on a line of it's own, as \. can occur in
data, but in text mode we accept it at any point.

Does anyone object to changing that so that we only accept \. on a line
of its own in text mode as well? That way we wouldn't need to care about
backslashes in CopyReadLineText. AFAIK our tools have always output the
\. like that, so this would only affect custom applications that use
COPY and the \. marker.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com