| From: | Andres Freund <andres(at)2ndquadrant(dot)com> |
|---|---|
| To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
| Cc: | Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: [PATCH] binary heap implementation |
| Date: | 2012-11-20 19:29:37 |
| Message-ID: | 20121120192936.GA5867@awork2.anarazel.de |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 2012-11-20 14:03:12 -0500, Robert Haas wrote:
> On Thu, Nov 15, 2012 at 8:56 PM, Abhijit Menon-Sen <ams(at)2ndquadrant(dot)com> wrote:
> > [ new patch ]
>
> I went over this again today with a view to getting it committed, but
> discovered some compiler warnings that look like this:
>
> warning: cast to pointer from integer of different size
>
> The problem seems to be that the binary heap implementation wants the
> key and value to be a void *, but the way it's being used in
> nodeMergeAppend.c the value is actually an int. I don't think we want
> to commit a binary heap implementation which has an impedance mismatch
> of this type with its only client. The obvious solution seems to be
> to make the key and value each a Datum, and then clients can use
> WhateverGetDatum and DatumGetWhatever to pass whatever built-in data
> type they happen to have. I'm trying that approach now and will post
> an updated patch based on that approach if it seems to work OK and
> nobody suggests something better between now and then.
Sounds like a good plan, one other alternative would have been declaring
the parameters a size_t (and thus explicitly always big enough to store
a pointer, but also valid to store inline data) instead of using a
void*. But given there is DatumGetPointer/PointerGetDatum et al, using
the postgres-y datatype seems fine to me.
In the LCR case those really are pointers, so preserving that case is
important to me ;), but your proposal does that, so ...
Andres
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Boszormenyi Zoltan | 2012-11-20 19:32:56 | Re: [PATCH] Make pg_basebackup configure and start standby [Review] |
| Previous Message | Marko Tiikkaja | 2012-11-20 19:29:17 | Re: DEALLOCATE IF EXISTS |