Re: How to allocate space to structure instance - Mailing list pgsql-novice

From Rohit Goyal
Subject Re: How to allocate space to structure instance
Date
Msg-id CANqGtSsgmxn2RDVKpx+oS3QyvCETXh7rL7pQ3etUD03eY2cPrg@mail.gmail.com
Whole thread Raw
In response to Re: How to allocate space to structure instance  (amul sul <sul_amul@yahoo.co.in>)
Responses Re: How to allocate space to structure instance  (amul sul <sul_amul@yahoo.co.in>)
List pgsql-novice



On Wed, Dec 11, 2013 at 5:42 AM, amul sul <sul_amul@yahoo.co.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

pgsql-novice by date:

Previous
From: amul sul
Date:
Subject: Re: How to allocate space to structure instance
Next
From: amul sul
Date:
Subject: Re: How to allocate space to structure instance