Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-committerspgsql-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

pgsql-hackers by date

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

pgsql-committers by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group