plpgsql on 8.0b4 bug? - Mailing list pgsql-hackers

From James Robinson
Subject plpgsql on 8.0b4 bug?
Date
Msg-id 2B371291-396F-11D9-8BCB-000A9566A412@socialserve.com
Whole thread Raw
Responses Re: plpgsql on 8.0b4 bug?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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




----
James Robinson
Socialserve.com
Attachment

pgsql-hackers by date:

Previous
From: Matt
Date:
Subject: patch: plpgsql - access records with rec.(expr)
Next
From: G u i d o B a r o s i o
Date:
Subject: invalid page header