pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Yessica Brinkmann <yessica.brinkmann@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: I think that my data is saved correctly, but when printing again, other data appears
Date: Sun, 27 Oct 2019 22:38:57 +0100
Message-ID: <100bd8eb2dbacb96421549f65633a7cea7c50f8c.camel@cybertec.at> (raw)
In-Reply-To: <CABrYqSNRL7mmNWPE4qBWYQ-5oFWGYNY8aEVp4YW3J09V2k1HAA@mail.gmail.com>
References: <CABrYqSOSaFoM+FWNhajxpygVLWZECLt4nvtAwz7a_gunDgfgzQ@mail.gmail.com>
	<17316.1572011977@sss.pgh.pa.us>
	<6cn43v-kpk6i5gmroah-8s3fxj-obuf01-7gthsn-w01z6b-lpzvej-661z71jmpmi8-1npytb57lzgg-2cagvflpw1wnfjg834kpo46kpvh3rt-d709lq-mzqirq-vv9lx095h9fk-83gie7-rgk77o-xjfd1r.1572017048567@email.android.com>
	<CABrYqSNRL7mmNWPE4qBWYQ-5oFWGYNY8aEVp4YW3J09V2k1HAA@mail.gmail.com>

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






view thread (13+ messages)  latest in thread

Message-ID: <100bd8eb2dbacb96421549f65633a7cea7c50f8c.camel@cybertec.at>
Permalink:  ../100bd8eb2dbacb96421549f65633a7cea7c50f8c.camel@cybertec.at/
Also on:    postgresql.org/message-id/100bd8eb2dbacb96421549f65633a7cea7c50f8c.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, yessica.brinkmann@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: I think that my data is saved correctly, but when printing again, other data appears
  In-Reply-To: <100bd8eb2dbacb96421549f65633a7cea7c50f8c.camel@cybertec.at>
  References: <CABrYqSOSaFoM+FWNhajxpygVLWZECLt4nvtAwz7a_gunDgfgzQ@mail.gmail.com> <17316.1572011977@sss.pgh.pa.us> <6cn43v-kpk6i5gmroah-8s3fxj-obuf01-7gthsn-w01z6b-lpzvej-661z71jmpmi8-1npytb57lzgg-2cagvflpw1wnfjg834kpo46kpvh3rt-d709lq-mzqirq-vv9lx095h9fk-83gie7-rgk77o-xjfd1r.1572017048567@email.android.com> <CABrYqSNRL7mmNWPE4qBWYQ-5oFWGYNY8aEVp4YW3J09V2k1HAA@mail.gmail.com> <100bd8eb2dbacb96421549f65633a7cea7c50f8c.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox