Thread: failed Assert() in utf8_and_iso8859_1.c

failed Assert() in utf8_and_iso8859_1.c

From
Karel Zak
Date:
Hi,
I have file with this code:

----------
\l
SHOW SERVER_ENCODING;
SHOW CLIENT_ENCODING;

--- Languages table
---
CREATE TABLE lang
(--- 'id' is here lang abbreviation---id        varchar(3) PRIMARY KEY,name        varchar(16) NOT NULL    --- lang
fullname
);

COPY lang FROM stdin;
EN    English
DE    German
JP    Japanese
\.

----------
and now I use latest PostgreSQL from CVS:

$ psql anydb < langs.sql        List of databases  Name    |  Owner   | Encoding  
-----------+----------+-----------anydb     | zakkr    | UNICODEtemplate0 | postgres | SQL_ASCIItemplate1 | postgres |
SQL_ASCIItest     | postgres | SQL_ASCII
 
(4 rows)
server_encoding 
-----------------UNICODE
(1 row)
client_encoding 
-----------------LATIN1
(1 row)

NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index 'lang_pkey' for table 'lang'
CREATE TABLE
server closed the connection unexpectedly   This probably means the server terminated abnormally   before or while
processingthe request.
 
lost synchronization with server, resetting connection
connection to server was lost
In the server log file is:

TRAP: FailedAssertion("!(len > 0)", File: "utf8_and_iso8859_1.c", Line: 45)

If I use INSERT instead COPY it's OK.
   Karel


-- Karel Zak  <zakkr@zf.jcu.cz>http://home.zf.jcu.cz/~zakkr/C, PostgreSQL, PHP, WWW, http://docs.linux.cz,
http://mape.jcu.cz


Re: failed Assert() in utf8_and_iso8859_1.c

From
Tom Lane
Date:
Karel Zak <zakkr@zf.jcu.cz> writes:
>  In the server log file is:
> TRAP: FailedAssertion("!(len > 0)", File: "utf8_and_iso8859_1.c", Line: 45)

Hmm, looks like all the conversion_procs files have
Assert(len > 0);

Surely that should be Assert(len >= 0)?

I also notice that I neglected to change PG_RETURN_INT32(0) to
PG_RETURN_VOID() in these files.  That's only cosmetic, but
probably it should be done.
        regards, tom lane


Re: failed Assert() in utf8_and_iso8859_1.c

From
Tatsuo Ishii
Date:
> Hmm, looks like all the conversion_procs files have
> 
>     Assert(len > 0);
> 
> Surely that should be Assert(len >= 0)?
> 
> I also notice that I neglected to change PG_RETURN_INT32(0) to
> PG_RETURN_VOID() in these files.  That's only cosmetic, but
> probably it should be done.

Fixed.
--
Tatsuo Ishii