Re: PL/pgSQL "compilation error" - Mailing list pgsql-sql

From Richard Huxton
Subject Re: PL/pgSQL "compilation error"
Date
Msg-id 005001c0aca3$37208a20$1001a8c0@archonet.com
Whole thread Raw
In response to PL/pgSQL "compilation error"  (Tim Perdue <tim@perdue.net>)
List pgsql-sql
From: "Tim Perdue" <tim@perdue.net>

> Hello all - I apologize for the newbie-esque question, but the debug
output
> from postgres when you have a bug in your PL/pgSQL procedure is none to
> detailed.
>
> I've created the following procedure and am getting an error when I try to
> update the table. The error is something like "parse error near ; on line
50".
> Line 50 is the last line.

You're writing 50 line functions and you're calling yourself a newbie? Hate
to think what that makes me.

> There's probably something glaring wrong in here that I'm not seeing, but
any
> help would be appreciated.

Nothing huge leaps out at me except for the \ and the occasional lower-case
'new' - don't know if 'new' is the same as 'NEW' - not sure I've tried it.

I have used statements on multiple lines without the \ though, so it might
be worth snipping them and seeing what happens.

> I don't know if the \ at the end of the line is a problem, but those were
> added late in the game and didn't change the error message ;-)
[snip]
>             UPDATE artifact_counts_agg SET open_count=open_count-1 \
>                WHERE group_artifact_id=new.group_artifact_id;

Failing that, email me the definition of artifacts_count_agg and artifact
and I'll play with it here.

- Richard Huxton



pgsql-sql by date:

Previous
From: "Richard Huxton"
Date:
Subject: Re:
Next
From: Bruce Momjian
Date:
Subject: Re: PL/pgSQL "compilation error"