Re: PL/PgSQL: RAISE and the number of parameters

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/PgSQL: RAISE and the number of parameters
Date: 2014-08-12 11:09:44
Message-ID: alpine.DEB.2.10.1408121245280.23442@sto
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hello Marko,

> Here's a patch for making PL/PgSQL throw an error during compilation (instead
> of runtime) if the number of parameters passed to RAISE don't match the
> number of placeholders in error message. I'm sure people can see the pros of
> doing it this way.

Patch scanned, applied & tested without problem on head.

The compile-time raise parameter checking is a good move.

3 minor points:

- I would suggest to avoid "continue" within a loop so that the code is
simpler to understand, at least for me.

- I would suggest to update the documentation accordingly.

- The execution code now contains error detections which should never be
raised, but I suggest to keep it in place anyway. However I would suggest
to add comments about the fact that it should not be triggered.

See the attached patch which implements these suggestions on top of your


Attachment Content-Type Size
raise_check_v1-suggestion.patch text/x-diff 2.1 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Marko Tiikkaja 2014-08-12 11:23:26 Re: PL/PgSQL: RAISE and the number of parameters
Previous Message Andres Freund 2014-08-12 11:08:11 Re: Incorrect log message and checks in pgrecvlogical