> On Dec 2, 2022, at 08:02, Tom Lane <tgl@xxxxxxxxxxxxx> wrote: > > Pasi Oja-Nisula <pon@xxxxxx> writes: >> I would be perfectly satisfied, if the sql that produced the procedure >> would be stored "as is" read-only copy when it was compiled. > If you want an audit comparison point, I'd suggest capturing > the result of pg_get_functiondef or one of its sibling functions > just after creating your function. "pg_dump -s" is another > pretty credible mechanism for capturing schema details. Agreeing with Tom, I find the argument that this is important for auditing unpersuasive. Storing the original text but allowing the version that is actually executed to be different is a step away from anything like good auditing practice.