Re: pgindent vs try/catch

From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgman(at)candle(dot)pha(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgindent vs try/catch
Date: 2004-09-12 18:58:05
Message-ID: 1444.24.211.141.25.1095015485.squirrel@www.dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane said:
> I'm fairly displeased with what pgindent has done to single-line PG_TRY
> constructs, as in this example from pl_exec.c:
>
> *************** exec_stmt_block(PLpgSQL_execstate * esta
> *** 911,922 ****
> SPI_result_code_string(xrc));
>
> PG_TRY();
> ! {
> ! rc = exec_stmts(estate, block->body);
> ! }
> PG_CATCH();
> {
> ! ErrorData *edata;
> PLpgSQL_exceptions *exceptions;
> int j;
>
> --- 912,921 ----
> SPI_result_code_string(xrc));
>
> PG_TRY();
> ! rc = exec_stmts(estate, block->body);
> PG_CATCH();
> {
> ! ErrorData *edata;
> PLpgSQL_exceptions *exceptions;
> int j;
>
> *************** exec_stmt_block(PLpgSQL_execstate * esta
>
> On the whole I'd prefer that pgindent not suppress "unnecessary"
> brace pairs at all.

I had that argument a while ago with Bruce and lost :-) . It does horrible
things to if/else constructs too. The workaround is to put a comment in the
block. On the whole I agree with you, though. If I put braces in my program
it's for a reason, and the indenter shouldn't think it knows better than me.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gaetano Mendola 2004-09-12 19:39:10 Re: pgindent vs try/catch
Previous Message Gaetano Mendola 2004-09-12 18:40:36 security definer on views