I rewrote the transformLetStmt routine. Now, some checks and transformations are shared with VariableFence transformation and with PLAssignStmt transformation (after https://github.com/postgres/postgres/commit/b0fb2c6aa5a485e28210e13ae5536c1231b1261f )

Although I removed redundant code, the patch 0011 is longer (4KB/58KB), because I needed to modify another lines. But now, the code is much more consistent (and more robust).

Regards

Pavel