Re: proposal - plpgsql unique statement id - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: proposal - plpgsql unique statement id
Date
Msg-id CAFj8pRBWwxq5o1ATsRxXRCGLeptiOROg-aGqtWfQUXzgJbOuiA@mail.gmail.com
Whole thread Raw
In response to Re: proposal - plpgsql unique statement id  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers


čt 24. 1. 2019 v 23:08 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> committed

Why didn't this patch modify the dumping logic in pl_funcs.c to print
the IDs?  I'm not aware of other cases where we intentionally omit
fields from debug-support printouts.

Currently we don't print lineno, what is maybe for user more important information.

I looked to the code, and now I am thinking so it is little bit harder, than I expected. Any new information can break output formatting

static void
dump_loop(PLpgSQL_stmt_loop *stmt)
{
    dump_ind();
    printf("LOOP\n");

    dump_stmts(stmt->body);
   
    dump_ind();
    printf("    ENDLOOP\n");
}

can looks like

static void
dump_loop(PLpgSQL_stmt_loop *stmt, int stmtid_width)
{
    dump_ind();
    printf("%*d LOOP\n", stmtid_width, stmt->stmtid);

    dump_stmts(stmt->body);
   
    dump_ind();
    printf("         ENDLOOP\n");
}

It is some what do you expect ?

Regards

Maybe more simple


static void
dump_loop(PLpgSQL_stmt_loop *stmt, int stmtid_width)
{
    dump_ind();
    printf("LOOP {%d}\n",stmt->stmtid);

    dump_stmts(stmt->body);
   
    dump_ind();
    printf("         ENDLOOP\n");
}

Pavel



                        regards, tom lane

pgsql-hackers by date:

Previous
From: "Tsunakawa, Takayuki"
Date:
Subject: RE: Protect syscache from bloating with negative cache entries
Next
From: "Takashi Menjo"
Date:
Subject: RE: [HACKERS][PATCH] Applying PMDK to WAL operations for persistent memory