On Fri, 2019-10-25 at 22:06 -0300, Yessica Brinkmann wrote: > What I do not understand well is how to use CurrentMemoryContext and MemoryContextStrdup For examples using memotry contexts, search the PostgreSQL source code. To make memory management easier and safer, PostgreSQL has implemented its own memory management using "memory contexts". If you allocate memoty with "palloc", "pstrdup" and similar, that memory is allocated in the current memory context. If the memory context is reset or dropped, the memory is gone. MemoryContextStrdup enables you to create a copy of a string in an explicitly specified memory context. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com