Re: PL/PgSQL: RAISE and the number of parameters - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: PL/PgSQL: RAISE and the number of parameters
Date
Msg-id alpine.DEB.2.10.1408121245280.23442@sto
Whole thread Raw
In response to PL/PgSQL: RAISE and the number of parameters  (Marko Tiikkaja <marko@joh.to>)
Responses Re: PL/PgSQL: RAISE and the number of parameters
List 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 
patch.

-- 
Fabien.

pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Incorrect log message and checks in pgrecvlogical
Next
From: Marko Tiikkaja
Date:
Subject: Re: PL/PgSQL: RAISE and the number of parameters