How to copy Datum

From: "Wang, Chaoyong" <Chaoyong(dot)Wang(at)emc(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: How to copy Datum
Date: 2012-08-21 10:49:24
Message-ID: 95FA8B25DB5E2D4E889EB9BEB6A6406F3CACD6@CORPUSMX30B.corp.emc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

I'm trying to reduce the re-computing of window aggregation. Here the
AVG function for example.

The original window aggregation's transition value(transValue) of AVG is
an ArrayType, that contains two main values(sum, count).

Now, I'm using a temporary transition value (tempTransValue), and I need
to copy tempTransValue to the original window aggregation's transition
value(transValue).

I used the function datumCopy as following:

peraggstate->transValue = datumCopy(peraggstate->tempTransValue,
peraggstate->transtypeByVal, peraggstate->transtypeLen);

But when the copied transValue is passed to the invoke function, here is
int4_avg_accum, the ArrayType returned from PG_GETARG_ARRAYTYPE_P(0) is
null.

Which means the copy action is failed.

Anybody know why? Or give me some suggestions? Thanks very much.

Best Regards

Chaoyong Wang

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2012-08-21 12:31:58 Re: .Net/C# - How to use Entity Framework Code First with Npgsql?
Previous Message Pavel Stehule 2012-08-21 09:20:50 Re: Are there any options to parallelize queries?