proposal: enhancing plpgsql debug API - returns text value of variable content

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: proposal: enhancing plpgsql debug API - returns text value of variable content
Date: 2020-08-17 06:40:26
Message-ID: CAFj8pRD+dBPU0T-KrkP7ef6QNPDEsjYCejEsBe07NDq8TybOkA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I am working on tracing support to plpgsql_check

https://github.com/okbob/plpgsql_check

I would like to print content of variables - and now, I have to go some
deeper than I would like. I need to separate between scalar, row, and
record variables. PLpgSQL has code for it - but it is private.

Now plpgsql debug API has an API for expression evaluation - and it is
working fine, but there is a need to know the necessary namespace.
Unfortunately, the plpgsql variables have not assigned any info about
related namespaces. It increases the necessary work for implementing
conditional breakpoints or just printing all variables (and maintaining a
lot of plpgsql code outside plpgsql core).

So my proposals:

1. enhancing debug api about method

char *get_cstring_valule(PLpgSQL_variable *var, bool *isnull)

2. enhancing PLpgSQL_var structure about related namespace "struct
PLpgSQL_nsitem *ns",
PLpgSQL_stmt *scope statement (statement that limits scope of variable's
visibility). For usage in debuggers, tracers can be nice to have a info
about kind of variable (function argument, local variable, automatic custom
variable (FORC), automatic internal variable (SQLERRM, FOUND, TG_OP, ...).

Comments, notes?

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2020-08-17 06:46:39 proposal - reference to plpgsql_check from plpgsql doc
Previous Message yuzuko 2020-08-17 06:11:28 Re: Autovacuum on partitioned table (autoanalyze)