Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iOqFc-0003Cj-Q8 for pgsql-general@arkaria.postgresql.org; Sun, 27 Oct 2019 21:39:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iOqFb-00038G-Dx for pgsql-general@arkaria.postgresql.org; Sun, 27 Oct 2019 21:39:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iOqFb-000388-4a for pgsql-general@lists.postgresql.org; Sun, 27 Oct 2019 21:39:03 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iOqFX-0006z4-QO for pgsql-general@lists.postgresql.org; Sun, 27 Oct 2019 21:39:02 +0000 Received: by mail-wm1-x335.google.com with SMTP id q70so7425916wme.1 for ; Sun, 27 Oct 2019 14:38:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=f0O/AGAw5b3VF2lRkxwXx7SKS1A4oku8zYk5FDFZhjQ=; b=m69tDnrskp95Jgr7HPvy0ykIDG8txqYpS24ivP8OlgAQw2slwZw/wj9GZt0i9+fyNd Ji/BgCX76A4pp0+qKMKEssKxBFdDMkOxYxQl7a4+1nLWUMQMSzbCwetviVS2kakEOBBp nzmoWtkpF/g1bsUOmWuVCG/hNHjxM/x0yvIWNU/hOMRI7t0yUtegPc1tXYtumycALJXX piAtat6CegUc07yvp3VkCUUVc48HK5wnL+Vre/ZX1dwYLmMpFdFmjuzaF5vPDtpLLuqi x8sQcBN3ObnY5yUGcBysi4poXVkiVBeptPS3GYx3BJ3FZ42rUmMeacx9n9CTOnoRLlyZ 2JfQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=f0O/AGAw5b3VF2lRkxwXx7SKS1A4oku8zYk5FDFZhjQ=; b=XFjnzZ+F5qkraI/IADaNhDSK3yY4FuOc2qIUTXBOoo2HDn1FzeLr7uZPoF0Bsy5URp mdtyK92cvR8g5PT1vJM0qKlSTfEV8u5Ocvmv90Hmmx0eyvmfgU2Tv/uD5kaDlt6CCFpc 6MzuMg9zQ3BhxNwVu+SFhTNwoEoQ+lh5fvcU8en8P9SGV1v+9EC8CWe9+a8OvjnLSjwM GwOxkbXta2zGA9/moq1GHmELQF7Ppa7Kd/5lSH77MePOwMo3oT1o8kZlVpFyZ5kvRNln EvwA0YSo3YuIZdqWGvBEVTFrU+cYitOseLZdWSLzmrv5Q0O19tp1mCo/BnfEF5UcGsBl 6OxQ== X-Gm-Message-State: APjAAAX/VMy4UMJllc3SOYwEK+oQ+IZ6jUVrgktSsEvWxVgxBRjhl7yd e7asY6OTsJNqnw7xEsQRPvVc6w== X-Google-Smtp-Source: APXvYqyqPL/9qlxtxCohWl3x/u4JT2tdBrj8PaagKYePg70j1VwK5AZ3msKjGfGfU29ZygP2bZ3QqA== X-Received: by 2002:a7b:cd86:: with SMTP id y6mr13257470wmj.101.1572212338733; Sun, 27 Oct 2019 14:38:58 -0700 (PDT) Received: from localhost.localdomain ([213.33.70.35]) by smtp.gmail.com with ESMTPSA id x205sm11300766wmb.5.2019.10.27.14.38.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 27 Oct 2019 14:38:58 -0700 (PDT) Message-ID: <100bd8eb2dbacb96421549f65633a7cea7c50f8c.camel@cybertec.at> Subject: Re: I think that my data is saved correctly, but when printing again, other data appears From: Laurenz Albe To: Yessica Brinkmann , Tom Lane Cc: "pgsql-general@lists.postgresql.org" Date: Sun, 27 Oct 2019 22:38:57 +0100 In-Reply-To: References: <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> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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