Re: [COMMITTERS] pgsql: Move Trigger and TriggerDesc structs out of rel.h into a new rel

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [COMMITTERS] pgsql: Move Trigger and TriggerDesc structs out of rel.h into a new rel
Date: 2011-07-05 15:03:44
Message-ID: 1309877706-sup-1969@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Excerpts from Tom Lane's message of mar jul 05 10:47:03 -0400 2011:
> Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> writes:
> > Move Trigger and TriggerDesc structs out of rel.h into a new reltrigger.h
> > This lets us stop including rel.h into execnodes.h, which is a widely
> > used header.
>
> I'm confused why this patch added pg_am.h to predtest.c?

Because otherwise it fails to compile with this error:

gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wformat-security -fno-strict-aliasing -fwrapv -g -I../../../../src/include -I/pgsql/source/HEAD/src/include -D_GNU_SOURCE -I/usr/include/libxml2 -c -o predtest.o /pgsql/source/HEAD/src/backend/optimizer/util/predtest.c -MMD -MP -MF .deps/predtest.Po
/pgsql/source/HEAD/src/backend/optimizer/util/predtest.c: In function ‘get_btree_test_op’:
/pgsql/source/HEAD/src/backend/optimizer/util/predtest.c:1661:32: error: ‘BTREE_AM_OID’ undeclared (first use in this function)
/pgsql/source/HEAD/src/backend/optimizer/util/predtest.c:1661:32: note: each undeclared identifier is reported only once for each function it appears in
make: *** [predtest.o] Error 1

Since that symbol is defined in pg_am.h, I thought the most convenient
fix was to include just that file. I could, of course, have included
the whole of rel.h but that seemed a bit pointless. The relevant code
is actually dealing with opfamilies (pg_amop.h is already being
included):

/* Now search the opfamilies */
for (i = 0; i < catlist->n_members; i++)
{
HeapTuple pred_tuple = &catlist->members[i]->tuple;
Form_pg_amop pred_form = (Form_pg_amop) GETSTRUCT(pred_tuple);
HeapTuple clause_tuple;

/* Must be btree */
if (pred_form->amopmethod != BTREE_AM_OID)
continue;

(Of course, the reason this didn't fail previously is because rel.h
includes pg_am.h).

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2011-07-05 15:10:03 Re: [COMMITTERS] pgsql: Move Trigger and TriggerDesc structs out of rel.h into a new rel
Previous Message Simon Riggs 2011-07-05 15:00:25 Re: pgsql: Reset ALTER TABLE lock levels to AccessExclusiveLock in all case

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2011-07-05 15:06:42 Re: [HACKERS] COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"
Previous Message Pavel Golub 2011-07-05 14:52:06 COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"