Search code examples
postgresqlscopeplpgsqlpostgresql-9.5

How do I create a nested function in PL/pgSQL?


I would like to create a function in PL/pgSQL with a couple of nested (or inner) functions within it. This way I can break the problem down into smaller pieces but not have my smaller pieces accessible outside of this function.

Is it possible to do this in PL/pgSQL? If so, how?


Solution

  • Nested functions are not supported by PLpgSQL. The emulation has not any sense and it is non-productive (with possible negative performance impacts).