Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 91E71B5DC51 for ; Tue, 30 Aug 2011 05:52:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 86989-01-7 for ; Tue, 30 Aug 2011 08:52:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id AC135B5DDA7 for ; Tue, 30 Aug 2011 05:51:56 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p7U8pt9B014278 for ; Tue, 30 Aug 2011 08:51:55 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p7U8ptkf014277; Tue, 30 Aug 2011 08:51:55 GMT (envelope-from www) Date: Tue, 30 Aug 2011 08:51:55 GMT Message-Id: <201108300851.p7U8ptkf014277@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #6185: Segmentation fault with NULL string columns From: "Isaac Jurado" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201108/190 X-Sequence-Number: 31002 The following bug has been logged online: Bug reference: 6185 Logged by: Isaac Jurado Email address: ijurado@econcept.es PostgreSQL version: 8.4.8 Operating system: Ubuntu 10.04.03 LTS (x86_64) Description: Segmentation fault with NULL string columns Details: Here's the script to make it fail: CREATE DATABASE killme; \c killme CREATE FUNCTION to_ascii(bytea, name) RETURNS text AS 'to_ascii_encname' LANGUAGE internal; CREATE TABLE mytable (id INTEGER PRIMARY KEY, mytext TEXT); INSERT INTO mytable (id, mytext) VALUES (1, ''); SELECT * FROM mytable WHERE to_ascii(convert_to(mytext, 'latin1'), 'latin1') = to_ascii(convert_to('nicetry', 'latin1'), 'latin1'); UPDATE mytable SET mytext=NULL WHERE id=1; SELECT * FROM mytable WHERE to_ascii(convert_to(mytext, 'latin1'), 'latin1') = to_ascii(convert_to('nicetry', 'latin1'), 'latin1'); After the second query, the database server segfaults. Note that it only fails for NULL values. The to_ascii/convert_to combination is a recipe for diacritics elimination found on a PostgreSQL forum.