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
pets.sql
Description: Binary data
---- James Robinson Socialserve.com---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend