plpgsql on 8.0b4 bug?

From: James Robinson <jlrobins(at)socialserve(dot)com>
To: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: plpgsql on 8.0b4 bug?
Date: 2004-11-18 14:36:01
Message-ID: 2B371291-396F-11D9-8BCB-000A9566A412@socialserve.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

It seems that 8.0B4's plpgsql does not diagnose 'ELSIF' being
misspelled as 'ELSEIF' nearly as readily as did 7.4.x. 7.4 emits a
compile error at the right place, whereas 8.0b4 seems to treat
misspelled 'ELSEIF' blocks as unreachable code, making it quite hard to
diagnose what is actually amiss. If not plpgsql coding often, the
difference in spelling can be rather hard to see even when staring at
the docs.

Attached is a sample script used to massage data in a table from a bad
representation to a little better one (with misspellings in place).
Here's a minimal table definition to run it:

create table unit (
id int8 not null primary key,
pets boolean not null,
petscondition text
);

insert into unit values (1, true, 'Outside Only');

8.0B4 results:
[dynamic-94:~/cvs/social/misc-db-utils] jlrobins% psql < pets.sql
BEGIN
ALTER TABLE
CREATE FUNCTION
ERROR: No code determined for unit 1, t, "Outside Only"
ERROR: current transaction is aborted, commands ignored until end of
transaction block
ERROR: current transaction is aborted, commands ignored until end of
transaction block
ERROR: current transaction is aborted, commands ignored until end of
transaction block
ERROR: current transaction is aborted, commands ignored until end of
transaction block
ROLLBACK

7.4.6 results:
xs2 /tmp> psql ssc_sav < pets.sql
BEGIN
ALTER TABLE
CREATE FUNCTION
ERROR: syntax error at or near "ELSEIF" at character 1
CONTEXT: PL/pgSQL function "fix_pets" line 16 at SQL statement
ERROR: current transaction is aborted, commands ignored until end of
transaction block
ERROR: current transaction is aborted, commands ignored until end of
transaction block
ERROR: current transaction is aborted, commands ignored until end of
transaction block
ERROR: current transaction is aborted, commands ignored until end of
transaction block
COMMIT

Many thanks in advance,

James

Attachment Content-Type Size
pets.sql application/octet-stream 1.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message G u i d o B a r o s i o 2004-11-18 14:37:41 invalid page header
Previous Message Matt 2004-11-18 13:18:00 patch: plpgsql - access records with rec.(expr)