Re: How to allocate space to structure instance

From: Rohit Goyal <rhtgyl(dot)87(at)gmail(dot)com>
To: amul sul <sul_amul(at)yahoo(dot)co(dot)in>
Cc: "pgsql-novice(at)postgresql(dot)org" <pgsql-novice(at)postgresql(dot)org>
Subject: Re: How to allocate space to structure instance
Date: 2013-12-11 06:45:26
Message-ID: CANqGtSsgmxn2RDVKpx+oS3QyvCETXh7rL7pQ3etUD03eY2cPrg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Wed, Dec 11, 2013 at 5:42 AM, amul sul <sul_amul(at)yahoo(dot)co(dot)in> wrote:

>
> >Am I using wrong memory context? Or
> is there anything else also I should keep in mind.
>
> Yes it might be. Memory context of
> transaction is deleted at the end.
> If you want to preserved the information, you can allocated space for
> structure before begin transaction call.
>
>
> Regards,
> Amul Sul
>

Hi,

Can you please tel me the location in code where I can allocate space
before begin transaction call?

Right now, I am using spi_palloc function to alloctae memory to my
structure instance. I want to insert 10 rows in a table and want to store
the corresponding transaction ID in one link list. But, I am not able to
store them in a link list I alway loose the previous information and hence
cannot traverse the linklist to store new transaction Id at the end of link
list

Some senior in my course said, I am using wrong memory context. Can anyone
explain me the actual problem?

I have defined my struct in a header file and trying to create a simple
link list in one .c file.

Regards,
Rohit Goyal

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message amul sul 2013-12-11 07:37:18 Re: How to allocate space to structure instance
Previous Message amul sul 2013-12-11 00:12:43 Re: How to allocate space to structure instance