From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Nicolai Tufar" <ntufar(at)apb(dot)com(dot)tr> |
Cc: | "Joe Conway" <mail(at)joeconway(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Segmentation fault while COPY in 7.3 |
Date: | 2002-12-01 17:38:06 |
Message-ID: | 25344.1038764286@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-advocacy pgsql-general pgsql-hackers |
"Nicolai Tufar" <ntufar(at)apb(dot)com(dot)tr> writes:
> From: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>> Ohhh ...
>>
>> Nicolai, are you running with a client encoding different from server
>> encoding?
> Got it!
Okay, the problem is a double free of memory in COPY OUT. I've applied
the following patch for 7.3.1. (A better fix would be for COPY OUT to
run in a local memory context that it could reset every so often, like
once per row, and then we could remove these risky retail pfree's entirely.
I plan to do that instead in development sources.)
regards, tom lane
*** src/backend/commands/copy.c.orig Fri Oct 18 20:25:36 2002
--- src/backend/commands/copy.c Sun Dec 1 12:28:24 2002
***************
*** 1470,1478 ****
char *string;
char c;
char delimc = delim[0];
-
bool same_encoding;
! char *string_start;
int mblen;
int i;
--- 1470,1477 ----
char *string;
char c;
char delimc = delim[0];
bool same_encoding;
! char *string_start = NULL;
int mblen;
int i;
***************
*** 1481,1492 ****
{
string = (char *) pg_server_to_client((unsigned char *) server_string,
strlen(server_string));
! string_start = string;
}
else
{
string = server_string;
- string_start = NULL;
}
for (; (c = *string) != '\0'; string += mblen)
--- 1480,1491 ----
{
string = (char *) pg_server_to_client((unsigned char *) server_string,
strlen(server_string));
! if (string != server_string)
! string_start = string;
}
else
{
string = server_string;
}
for (; (c = *string) != '\0'; string += mblen)
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-12-01 17:53:55 | Re: 7.4 Wishlist |
Previous Message | Tom Lane | 2002-12-01 16:24:18 | Re: 7.4 Wishlist |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-12-01 17:53:55 | Re: 7.4 Wishlist |
Previous Message | Tom Lane | 2002-12-01 16:24:18 | Re: 7.4 Wishlist |
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2002-12-01 17:53:55 | Re: 7.4 Wishlist |
Previous Message | Thomas A. Lowery | 2002-12-01 16:58:14 | Re: ANNOUNCE: DBD::Pg 1.20 |