Re: C function migration from 9.2 to 9.5

From: Michael Omotayo Akinde <michaeloa(at)met(dot)no>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pavel(dot)stehule(at)gmail(dot)com, pgsql-general(at)postgresql(dot)org
Subject: Re: C function migration from 9.2 to 9.5
Date: 2016-03-04 12:04:31
Message-ID: CALfUbhMCU30obRtBHvjr9PYjEdZjGKxtsNkU1kDf0rbx58r9JA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Nailed it. Ensuring heap_form_tuple was properly defined resolved the issue.

Thanks a lot. Without your help, I would probably have spent more time
looking at the 32 <=> 64 bit thing first, since I was pretty certain that
we had this warning in the old compile. I suspect I am wrong about that,
though, and that the actual problem is the heap_form_tuple declaration
being relocated, as you suggest. In either case, going through the code and
ensuring that we had that include everywhere in the code seems to have
cleared up the problems (all tests running OK).

Regards,

Michael A.

On Fri, Mar 4, 2016 at 1:52 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Michael Omotayo Akinde <michaeloa(at)met(dot)no> writes:
> > This throws a compiler warning on the cast from heap_form_tuple to
> > HeapTuple, but IIRC it's always done that so not an error?
>
> Uh, that's *awfully* fishy, because heap_form_tuple certainly returns
> HeapTuple. I wondered why you had that cast there; it should not be
> necessary. If the compiler is warning about it, that sets off all kinds
> of alarm bells.
>
> I notice your test program fails to #include "access/htup_details.h",
> which is where heap_form_tuple() is declared these days. I wonder if
> your problem boils down to "no visible declaration of function, so
> compiler thinks it returns int"? In that case the real difference
> from what worked to what didn't probably had less to do with any PG
> version change and more to do with moving from 32-bit to 64-bit.
> (Or I guess we might've relocated the declaration of heap_form_tuple
> somewhere along the line.)
>
> A general tip for getting C code to work is to turn on as many
> compiler warnings as you can, and never ignore any of them.
>
> regards, tom lane
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rafal Pietrak 2016-03-04 13:30:52 Re: multiple UNIQUE indices for FK
Previous Message Francisco Olarte 2016-03-04 11:59:37 Re: multiple UNIQUE indices for FK