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

From Alvaro Herrera
Subject Re: [COMMITTERS] pgsql: Move Trigger and TriggerDesc structs out of rel.h into a new rel
Date
Msg-id 1309877706-sup-1969@alvh.no-ip.org
Whole thread Raw
Responses Re: [COMMITTERS] pgsql: Move Trigger and TriggerDesc structs out of rel.h into a new rel
List pgsql-hackers
Excerpts from Tom Lane's message of mar jul 05 10:47:03 -0400 2011:
> Alvaro Herrera <alvherre@alvh.no-ip.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
oncefor 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@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: [v9.2] SECURITY LABEL on shared database object
Next
From: Alvaro Herrera
Date:
Subject: Re: COPY .... WITH (FORMAT binary) causes syntax error at or near "binary"