From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | mlw <markw(at)mohawksoft(dot)com> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: sig 11 in RC3 |
Date: | 2002-01-04 16:02:04 |
Message-ID: | 5238.1010160124@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
mlw <markw(at)mohawksoft(dot)com> writes:
> I have a couple functions which form the basis of an aggregate.
You can't lie to the system by claiming your state value is an integer
when it's really a pointer to palloc'd memory. The memory will get
recycled out from under you.
Try declaring the aggregate as using int4[] as the transition type,
and make sure that the intermediate states are valid at least to the
point of having a correct varlena length word. This will allow the
system to copy the values around when it needs to.
Alternatively, keep the data structure in a longer-lived context
(TransactionCommandContext should work) instead of the per-tuple
context. That's uglier but would avoid a lot of copying.
See src/backend/executor/nodeAgg.c if you are wondering why the state
values need to be copied around.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Holger Krug | 2002-01-04 16:36:57 | ON ERROR triggers |
Previous Message | Thomas Lockhart | 2002-01-04 15:52:45 | Re: datetime error? |