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

Re: COPY FROM is not 8bit clean

From: Darcy Buskermolen <darcy(at)ok-connect(dot)com>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: COPY FROM is not 8bit clean
Date: 2002-02-26 16:30:01
Message-ID: 3.0.32.20020226083000.02cc2550@mail.ok-connect.com (view raw or flat)
Thread:
Lists: pgsql-bugspgsql-hackers
This patch solves the problem.

At 09:16 PM 2/26/02 +0900, Tatsuo Ishii wrote:
>> When useing COPY FROM 'file' DELIMITER '\254' copyfrom reads past the
>> delimiter and ends up with parse errors when trying to do the insert
>> 
>> 
>> What the ?? why dind' tthat go through with the body of the text.. *sigh*
>> I'll resend in the AM.. 
>
>Good catch. It's definitely a bug in copy command. Please try
>following patches (this is against 7.2).
>
>*** src/backend/commands/copy.c.orig	Tue Feb 26 21:11:05 2002
>--- src/backend/commands/copy.c	Tue Feb 26 21:11:35 2002
>***************
>*** 1024,1030 ****
>  CopyReadAttribute(FILE *fp, bool *isnull, char *delim, int *newline,
char *null_print)
>  {
>  	int			c;
>! 	int			delimc = delim[0];
>  
>  #ifdef MULTIBYTE
>  	int			mblen;
>--- 1024,1030 ----
>  CopyReadAttribute(FILE *fp, bool *isnull, char *delim, int *newline,
char *null_print)
>  {
>  	int			c;
>! 	int			delimc = (unsigned char)delim[0];
>  
>  #ifdef MULTIBYTE
>  	int			mblen;
>
>

Responses

pgsql-hackers by date

Next:From: Oliver ElphickDate: 2002-02-26 16:41:38
Subject: COPY incorrectly uses null instead of an empty string in last field
Previous:From: Tom LaneDate: 2002-02-26 16:08:21
Subject: Re: quotes in SET grammar

pgsql-bugs by date

Next:From: Erol OzcanDate: 2002-02-26 16:36:02
Subject: Re: Bug #604: string join problem
Previous:From: Darcy BuskermolenDate: 2002-02-26 16:23:22
Subject: Re: COPY FROM is not 8bit clean

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