Chris McDonald <chrisjonmcdonald(at)gmail(dot)com> writes:
> Still interested in a definitive answer, but the fix for me appears to be simply to change the word open to something else.
Well, if you want a definitive answer, you can consult the list of
plpgsql reserved words here:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/pl/plpgsql/src/pl_scanner.c;h=76e8436e50e9c1d4919a60916b0cabfa83a13eb1;hb=HEAD#l30
where you will find that "open" is indeed a reserved word.
regards, tom lane