Excerpts from Tom Lane's message of mar jul 05 10:47:03 -0400 2011:
> Alvaro Herrera <alvhe...@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 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 <alvhe...@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to