Re: [HACKERS] [GENERAL] Segmentation fault while COPY in 7.3

2002-12-01 Thread Tom Lane
Nicolai Tufar [EMAIL PROTECTED] writes:
 From: Tom Lane [EMAIL PROTECTED]
 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.origFri Oct 18 20:25:36 2002
--- src/backend/commands/copy.c Sun Dec  1 12:28:24 2002
***
*** 1470,1478 
char   *string;
charc;
chardelimc = delim[0];
- 
boolsame_encoding;
!   char   *string_start;
int mblen;
int i;
  
--- 1470,1477 
char   *string;
charc;
chardelimc = delim[0];
boolsame_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)

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org



Re: [HACKERS] [GENERAL] Segmentation fault while COPY in 7.3

2002-11-30 Thread Nicolai Tufar
- Original Message -
From: Tom Lane [EMAIL PROTECTED]


 Ohhh ...

 Nicolai, are you running with a client encoding different from server
 encoding?

Got it!
Gentlemen, thank you very much for assistance. The body of evidence was
slowly
growing, then, finaly Tom Lan's message have enlightened me.

It all started with initdb's warning that it can not set client's connection
to 'LATIN5'.
Okay, I said, maybe some system files are not installed. Then I tried to
create a database
with ENCODING='LATIN5'. I did not pay much attention either since my
template1 and
template0 are in LATIN5. Then on Tom's suggestion I tried to change client
encoding:

aaa=# \encoding
LATIN5
aaa=# \encoding SQL_ASCII
SQL_ASCII: invalid encoding name or conversion procedure not found
aaa=# \encoding LATIN5
LATIN5: invalid encoding name or conversion procedure not found
aaa=# \encoding SQL_ASCii
aaa=# \encoding
SQL_ASCII
aaa=# \encoding LATiN5
aaa=# \encoding
LATIN5
aaa=#

So it all falls back to Turkish I problem I mentioned earlier. To
perform COPY successfully I had to set client locale to 'LATiN5'
(note quotes and lower-case i). Any other combinations result
in segmentation fault.

Now, would it be right to change locale name handling to use ASCII-only
lower and upper-case conversions?

Many thanks to Tom Lane and Joe Conway.


I've got to get some sleep :-)
Regards,
Nic.




---(end of broadcast)---
TIP 4: Don't 'kill -9' the postmaster