Bus Error in psql command history

From: Isaac Morland <ijmorlan(at)uwaterloo(dot)ca>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Bus Error in psql command history
Date: 2009-09-30 19:30:23
Message-ID: Pine.GSO.4.64.0909301512090.15748@core.cs.uwaterloo.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

I run psql on Mac OS X:

psql (8.4.1, server 8.4.0)

Then paste the following in, having been copied from an XCode editor
window:

CREATE OR REPLACE FUNCTION compute_mw_realname (
nicknames text,
givennames text,
surname text
) RETURNS text AS $$
DECLARE
first text;
last text;
BEGIN
last := replace (trim (surname), '-', '');
IF nicknames IS NOT NULL THEN
first := replace (trim (nicknames), '-', '');
IF substring (first from 1 + length (first) - length (last))
= last THEN
first := trim (substring
(first from 1 for length (first) - length (last)));
IF first = '' THEN
first = replace (trim (givennames), '-', '');
END IF;
END IF;
ELSE
first := replace (trim (givennames), '-', '');
END IF;
first = replace (first, '-', '');
RETURN upper (substring (first from 1 for 1)) ||
substring (first from 2) || ' ' || last;
END;
$$ LANGUAGE PLPGSQL IMMUTABLE;

After this executes, which it does successfully, if I use cursor-up to
re-display this command, I get an immediate bus error and psql quits.

If I don't use cursor-up, I can continue typing commands, but if I later
cursor-up far enough that the above command should be re-displayed then I
get the bus error at that time.

Works fine on psql 8.4.1 for Solaris.

Please advise if you would like any more details about the behaviour. I
can think of a few things to investigate but none that jumps out as the
obvious thing to look into.

Isaac Morland CSCF Web Guru
DC 2554C, x36650 WWW Software Specialist

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2009-09-30 20:27:00 Re: Bus Error in psql command history
Previous Message Tom Lane 2009-09-30 13:58:11 Re: Weird behaviour of = ANY ( SUBQUERY ) ?