1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

This patch...

1. Removes the unnecessary "#define AbcRegProcedure 123"'s from
pg_proc.h.

2. Changes those #defines to use the names already defined in
fmgr.h.

3. Forces the make of fmgr.h in backend/Makefile instead of having
it
   made as a dependency in access/common/Makefile  *hack*hack*hack*

4. Rearranged the #includes to a less helter-skelter arrangement,
also
    changing <file.h> to "file.h" to signify a non-system header.

5. Removed "pg_proc.h" from files where its only purpose was for
the
   #defines removed in item #1.

6. Added "fmgr.h" to each file changed for completeness sake.

Turns out that #6 was not necessary for some files because fmgr.h
was being included in a roundabout way SIX levels deep by the first
include.

"access/genam.h"
 ->"access/relscan.h"
   ->"utils/rel.h"
     ->"access/strat.h"
       ->"access/skey.h"
	 ->"fmgr.h"

So adding fmgr.h really didn't add anything to the compile, hopefully
just made it clearer to the programmer.

S Darren.
This commit is contained in:
Bruce Momjian
1998-04-27 04:08:07 +00:00
parent e8fd57d763
commit 09baa3cc81
29 changed files with 472 additions and 524 deletions

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.30 1998/04/01 03:13:37 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.31 1998/04/27 04:05:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,25 +65,24 @@
#include <sys/types.h> /* Needed by in.h on Ultrix */
#include <netinet/in.h>
#include <postgres.h>
#include "postgres.h"
#include <miscadmin.h>
#include <utils/syscache.h>
#include <access/relscan.h>
#include <access/xact.h>
#include <lib/dllist.h>
#include <tcop/dest.h>
#include <catalog/pg_proc.h>
#include <catalog/catname.h>
#include <catalog/pg_listener.h>
#include <access/heapam.h>
#include <storage/bufmgr.h>
#include <nodes/memnodes.h>
#include <utils/mcxt.h>
#include <commands/async.h>
#include <libpq/libpq.h>
#include <storage/lmgr.h>
#include "access/heapam.h"
#include "access/relscan.h"
#include "access/xact.h"
#include "catalog/catname.h"
#include "catalog/pg_listener.h"
#include "commands/async.h"
#include "fmgr.h"
#include "lib/dllist.h"
#include "libpq/libpq.h"
#include "miscadmin.h"
#include "nodes/memnodes.h"
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "tcop/dest.h"
#include "utils/mcxt.h"
#include "utils/syscache.h"
static int notifyFrontEndPending = 0;
static int notifyIssued = 0;
@@ -199,7 +198,7 @@ Async_Notify(char *relname)
ScanKeyEntryInitialize(&key, 0,
Anum_pg_listener_relname,
NameEqualRegProcedure,
F_NAMEEQ,
PointerGetDatum(notifyName));
lRel = heap_openr(ListenerRelationName);
@@ -281,7 +280,7 @@ Async_NotifyAtCommit()
#endif
ScanKeyEntryInitialize(&key, 0,
Anum_pg_listener_notify,
Integer32EqualRegProcedure,
F_INT4EQ,
Int32GetDatum(1));
lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel);
@@ -584,11 +583,11 @@ Async_NotifyFrontEnd()
StartTransactionCommand();
ScanKeyEntryInitialize(&key[0], 0,
Anum_pg_listener_notify,
Integer32EqualRegProcedure,
F_INT4EQ,
Int32GetDatum(1));
ScanKeyEntryInitialize(&key[1], 0,
Anum_pg_listener_pid,
Integer32EqualRegProcedure,
F_INT4EQ,
Int32GetDatum(MyProcPid));
lRel = heap_openr(ListenerRelationName);
RelationSetLockForWrite(lRel);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.26 1998/02/26 04:30:49 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.27 1998/04/27 04:05:10 momjian Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
@@ -20,25 +20,25 @@
*
*-------------------------------------------------------------------------
*/
#include <postgres.h>
#include "postgres.h"
#include <access/relscan.h>
#include <utils/portal.h>
#include <commands/command.h>
#include <utils/mcxt.h>
#include <executor/executor.h>
#include <executor/execdefs.h>
#include <catalog/indexing.h>
#include <utils/syscache.h>
#include <catalog/catalog.h>
#include <access/heapam.h>
#include <utils/array.h>
#include <utils/acl.h>
#include <optimizer/prep.h>
#include <catalog/catname.h>
#include <catalog/pg_proc.h>
#include <catalog/pg_type.h>
#include <utils/builtins.h>
#include "access/heapam.h"
#include "access/relscan.h"
#include "catalog/indexing.h"
#include "catalog/catalog.h"
#include "catalog/catname.h"
#include "catalog/pg_type.h"
#include "commands/command.h"
#include "executor/execdefs.h"
#include "executor/executor.h"
#include "fmgr.h"
#include "optimizer/prep.h"
#include "utils/acl.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/mcxt.h"
#include "utils/portal.h"
#include "utils/syscache.h"
/* ----------------
* PortalExecutorHeapMemory stuff
@@ -409,13 +409,13 @@ PerformAddAttribute(char *relationName,
ScanKeyEntryInitialize(&key[0],
(bits16) NULL,
(AttrNumber) Anum_pg_attribute_attrelid,
(RegProcedure) ObjectIdEqualRegProcedure,
(RegProcedure) F_OIDEQ,
(Datum) reltup->t_oid);
ScanKeyEntryInitialize(&key[1],
(bits16) NULL,
(AttrNumber) Anum_pg_attribute_attname,
(RegProcedure) NameEqualRegProcedure,
(RegProcedure) F_NAMEEQ,
(Datum) NULL);
attributeD.attrelid = reltup->t_oid;

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.12 1998/04/26 04:06:27 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/dbcommands.c,v 1.13 1998/04/27 04:05:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -17,22 +17,22 @@
#include <sys/stat.h>
#include "postgres.h"
#include "miscadmin.h" /* for DataDir */
#include "access/heapam.h"
#include "access/htup.h"
#include "access/relscan.h"
#include "utils/rel.h"
#include "utils/elog.h"
#include "catalog/catname.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_shadow.h"
#include "catalog/pg_database.h"
#include "utils/syscache.h"
#include "catalog/pg_shadow.h"
#include "commands/dbcommands.h"
#include "tcop/tcopprot.h"
#include "fmgr.h"
#include "miscadmin.h" /* for DataDir */
#include "storage/bufmgr.h"
#include "storage/lmgr.h"
#include "storage/fd.h"
#include "storage/lmgr.h"
#include "tcop/tcopprot.h"
#include "utils/rel.h"
#include "utils/syscache.h"
/* non-export function prototypes */
@@ -157,7 +157,7 @@ get_pg_dbtup(char *command, char *dbname, Relation dbrel)
ScanKeyData scanKey;
ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
NameEqualRegProcedure, NameGetDatum(dbname));
F_NAMEEQ, NameGetDatum(dbname));
scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
if (!HeapScanIsValid(scan))

View File

@@ -7,16 +7,17 @@
*/
#include <ctype.h>
#include <string.h>
#include "postgres.h"
#include "access/heapam.h"
#include "catalog/catname.h"
#include "catalog/pg_shadow.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_language.h"
#include "utils/syscache.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_shadow.h"
#include "commands/proclang.h"
#include "fmgr.h"
#include "utils/syscache.h"
static void
@@ -120,7 +121,7 @@ CreateProceduralLanguage(CreatePLangStmt *stmt)
values[i++] = Int8GetDatum((bool) 1);
values[i++] = Int8GetDatum(stmt->pltrusted);
values[i++] = ObjectIdGetDatum(procTup->t_oid);
values[i++] = (Datum) fmgr(TextInRegProcedure, stmt->plcompiler);
values[i++] = (Datum) fmgr(F_TEXTIN, stmt->plcompiler);
rdesc = heap_openr(LanguageRelationName);

View File

@@ -7,27 +7,28 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.22 1998/02/11 19:10:20 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.23 1998/04/27 04:05:19 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <postgres.h>
#include "postgres.h"
#include "access/heapam.h"
#include "catalog/catname.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_language.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_type.h"
#include "commands/defrem.h"
#include "fmgr.h"
#include "miscadmin.h"
#include "parser/parse_func.h"
#include "storage/bufmgr.h"
#include "utils/acl.h"
#include "utils/builtins.h"
#include "utils/syscache.h"
#include <utils/acl.h>
#include <access/heapam.h>
#include <utils/builtins.h>
#include <utils/syscache.h>
#include <catalog/catname.h>
#include <commands/defrem.h>
#include <miscadmin.h>
#include <catalog/pg_aggregate.h>
#include <catalog/pg_language.h>
#include <catalog/pg_operator.h>
#include <catalog/pg_proc.h>
#include <catalog/pg_type.h>
#include <parser/parse_func.h>
#include <storage/bufmgr.h>
#include <fmgr.h>
#ifndef HAVE_MEMMOVE
#include <regex/utils.h>
#else
@@ -82,17 +83,17 @@ RemoveOperator(char *operatorName, /* operator name */
ScanKeyEntryInitialize(&operatorKey[0], 0x0,
Anum_pg_operator_oprname,
NameEqualRegProcedure,
F_NAMEEQ,
PointerGetDatum(operatorName));
ScanKeyEntryInitialize(&operatorKey[1], 0x0,
Anum_pg_operator_oprleft,
ObjectIdEqualRegProcedure,
F_OIDEQ,
ObjectIdGetDatum(typeId1));
ScanKeyEntryInitialize(&operatorKey[2], 0x0,
Anum_pg_operator_oprright,
ObjectIdEqualRegProcedure,
F_OIDEQ,
ObjectIdGetDatum(typeId2));
relation = heap_openr(OperatorRelationName);
@@ -159,7 +160,7 @@ SingleOpOperatorRemove(Oid typeOid)
int i;
ScanKeyEntryInitialize(&key[0],
0, 0, ObjectIdEqualRegProcedure, (Datum) typeOid);
0, 0, F_OIDEQ, (Datum) typeOid);
rdesc = heap_openr(OperatorRelationName);
for (i = 0; i < 3; ++i)
{
@@ -207,7 +208,7 @@ AttributeAndRelationRemove(Oid typeOid)
*/
ScanKeyEntryInitialize(&key[0],
0, 3, ObjectIdEqualRegProcedure, (Datum) typeOid);
0, 3, F_OIDEQ, (Datum) typeOid);
oidptr = (struct oidlist *) palloc(sizeof(*oidptr));
oidptr->next = NULL;
@@ -228,7 +229,7 @@ AttributeAndRelationRemove(Oid typeOid)
ScanKeyEntryInitialize(&key[0], 0,
ObjectIdAttributeNumber,
ObjectIdEqualRegProcedure, (Datum) 0);
F_OIDEQ, (Datum) 0);
optr = oidptr;
rdesc = heap_openr(RelationRelationName);
while (PointerIsValid((char *) optr->next))
@@ -264,7 +265,7 @@ RemoveType(char *typeName) /* type name to be removed */
Oid typeOid;
ItemPointerData itemPointerData;
static ScanKeyData typeKey[1] = {
{0, Anum_pg_type_typname, NameEqualRegProcedure}
{0, Anum_pg_type_typname, F_NAMEEQ}
};
char *shadow_type;
char *userName;
@@ -342,7 +343,7 @@ RemoveFunction(char *functionName, /* function name to be removed */
Form_pg_proc the_proc = NULL;
ItemPointerData itemPointerData;
static ScanKeyData key[3] = {
{0, Anum_pg_proc_proname, NameEqualRegProcedure}
{0, Anum_pg_proc_proname, F_NAMEEQ}
};
char *userName;
char *typename;
@@ -489,12 +490,12 @@ RemoveAggregate(char *aggName, char *aggType)
ScanKeyEntryInitialize(&aggregateKey[0], 0x0,
Anum_pg_aggregate_aggname,
NameEqualRegProcedure,
F_NAMEEQ,
PointerGetDatum(aggName));
ScanKeyEntryInitialize(&aggregateKey[1], 0x0,
Anum_pg_aggregate_aggbasetype,
ObjectIdEqualRegProcedure,
F_OIDEQ,
ObjectIdGetDatum(basetypeID));
relation = heap_openr(AggregateRelationName);

View File

@@ -8,19 +8,20 @@
#include <string.h>
#include "postgres.h"
#include "nodes/parsenodes.h"
#include "nodes/memnodes.h"
#include "commands/trigger.h"
#include "catalog/catalog.h"
#include "catalog/catname.h"
#include "catalog/indexing.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_language.h"
#include "catalog/pg_trigger.h"
#include "access/genam.h"
#include "access/heapam.h"
#include "access/valid.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/catname.h"
#include "catalog/indexing.h"
#include "catalog/pg_language.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_trigger.h"
#include "commands/trigger.h"
#include "fmgr.h"
#include "nodes/memnodes.h"
#include "nodes/parsenodes.h"
#include "storage/lmgr.h"
#include "storage/bufmgr.h"
#include "utils/mcxt.h"
@@ -117,7 +118,7 @@ CreateTrigger(CreateTrigStmt *stmt)
tgrel = heap_openr(TriggerRelationName);
RelationSetLockForWrite(tgrel);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
ObjectIdEqualRegProcedure, rel->rd_id);
F_OIDEQ, rel->rd_id);
tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
{
@@ -277,7 +278,7 @@ DropTrigger(DropTrigStmt *stmt)
tgrel = heap_openr(TriggerRelationName);
RelationSetLockForWrite(tgrel);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
ObjectIdEqualRegProcedure, rel->rd_id);
F_OIDEQ, rel->rd_id);
tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
{
@@ -341,7 +342,7 @@ RelationRemoveTriggers(Relation rel)
tgrel = heap_openr(TriggerRelationName);
RelationSetLockForWrite(tgrel);
ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
ObjectIdEqualRegProcedure, rel->rd_id);
F_OIDEQ, rel->rd_id);
tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
@@ -379,7 +380,7 @@ RelationBuildTriggers(Relation relation)
ScanKeyEntryInitialize(&skey,
(bits16) 0x0,
(AttrNumber) 1,
(RegProcedure) ObjectIdEqualRegProcedure,
(RegProcedure) F_OIDEQ,
ObjectIdGetDatum(relation->rd_id));
tgrel = heap_openr(TriggerRelationName);

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.63 1998/02/26 04:31:03 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.64 1998/04/27 04:05:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -18,35 +18,34 @@
#include <fcntl.h>
#include <unistd.h>
#include <postgres.h>
#include "postgres.h"
#include <fmgr.h>
#include <utils/portal.h>
#include <access/genam.h>
#include <access/heapam.h>
#include <access/xact.h>
#include <storage/bufmgr.h>
#include <access/transam.h>
#include <catalog/pg_index.h>
#include <catalog/index.h>
#include <catalog/catname.h>
#include <catalog/catalog.h>
#include <catalog/pg_class.h>
#include <catalog/pg_proc.h>
#include <catalog/pg_statistic.h>
#include <catalog/pg_type.h>
#include <catalog/pg_operator.h>
#include <parser/parse_oper.h>
#include <storage/smgr.h>
#include <storage/lmgr.h>
#include <utils/inval.h>
#include <utils/mcxt.h>
#include <utils/inval.h>
#include <utils/syscache.h>
#include <utils/builtins.h>
#include <commands/vacuum.h>
#include <storage/bufpage.h>
#include "access/genam.h"
#include "access/heapam.h"
#include "access/transam.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/catname.h"
#include "catalog/index.h"
#include "catalog/pg_class.h"
#include "catalog/pg_index.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_statistic.h"
#include "catalog/pg_type.h"
#include "commands/vacuum.h"
#include "fmgr.h"
#include "parser/parse_oper.h"
#include "storage/bufmgr.h"
#include "storage/bufpage.h"
#include "storage/shmem.h"
#include "storage/smgr.h"
#include "storage/lmgr.h"
#include "utils/builtins.h"
#include "utils/inval.h"
#include "utils/mcxt.h"
#include "utils/portal.h"
#include "utils/syscache.h"
#ifndef HAVE_GETRUSAGE
#include <rusagestub.h>
#else
@@ -279,13 +278,13 @@ vc_getrels(NameData *VacRelP)
if (VacRelP->data)
{
ScanKeyEntryInitialize(&pgckey, 0x0, Anum_pg_class_relname,
NameEqualRegProcedure,
F_NAMEEQ,
PointerGetDatum(VacRelP->data));
}
else
{
ScanKeyEntryInitialize(&pgckey, 0x0, Anum_pg_class_relkind,
CharacterEqualRegProcedure, CharGetDatum('r'));
F_CHAREQ, CharGetDatum('r'));
}
portalmem = PortalGetVariableMemory(vc_portal);
@@ -398,7 +397,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
StartTransactionCommand();
ScanKeyEntryInitialize(&pgckey, 0x0, ObjectIdAttributeNumber,
ObjectIdEqualRegProcedure,
F_OIDEQ,
ObjectIdGetDatum(relid));
pgclass = heap_openr(RelationRelationName);
@@ -1776,7 +1775,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
* update number of tuples and number of pages in pg_class
*/
ScanKeyEntryInitialize(&rskey, 0x0, ObjectIdAttributeNumber,
ObjectIdEqualRegProcedure,
F_OIDEQ,
ObjectIdGetDatum(relid));
rd = heap_openr(RelationRelationName);
@@ -1890,10 +1889,10 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
values[i++] = (Datum) InvalidOid; /* 3 */
fmgr_info(stats->outfunc, &out_function);
out_string = (*fmgr_faddr(&out_function)) (stats->min, stats->attr->atttypid);
values[i++] = (Datum) fmgr(TextInRegProcedure, out_string);
values[i++] = (Datum) fmgr(F_TEXTIN, out_string);
pfree(out_string);
out_string = (char *) (*fmgr_faddr(&out_function)) (stats->max, stats->attr->atttypid);
values[i++] = (Datum) fmgr(TextInRegProcedure, out_string);
values[i++] = (Datum) fmgr(F_TEXTIN, out_string);
pfree(out_string);
sdesc = sd->rd_att;
@@ -1948,7 +1947,7 @@ vc_delhilowstats(Oid relid, int attcnt, int *attnums)
if (relid != InvalidOid)
{
ScanKeyEntryInitialize(&pgskey, 0x0, Anum_pg_statistic_starelid,
ObjectIdEqualRegProcedure,
F_OIDEQ,
ObjectIdGetDatum(relid));
pgsscan = heap_beginscan(pgstatistic, false, false, 1, &pgskey);
}
@@ -2159,7 +2158,7 @@ vc_getindices(Oid relid, int *nindices, Relation **Irel)
pgidesc = RelationGetTupleDescriptor(pgindex);
ScanKeyEntryInitialize(&pgikey, 0x0, Anum_pg_index_indrelid,
ObjectIdEqualRegProcedure,
F_OIDEQ,
ObjectIdGetDatum(relid));
pgiscan = heap_beginscan(pgindex, false, false, 1, &pgikey);