head 1.30; access; symbols release_4_2:1.30 aix_ok:1.28 Version_2_1:1.21 Version_2:1.12 C_Demo_1:1.6; locks; strict; comment @ * @; 1.30 date 94.02.07.11.53.01; author aoki; state Exp; branches; next 1.29; 1.29 date 94.02.02.00.22.27; author marc; state Exp; branches; next 1.28; 1.28 date 93.09.26.00.20.22; author paxson; state Exp; branches; next 1.27; 1.27 date 93.03.17.20.04.24; author aoki; state Exp; branches; next 1.26; 1.26 date 92.12.19.01.38.45; author aoki; state Exp; branches; next 1.25; 1.25 date 92.09.08.05.21.02; author mao; state Exp; branches; next 1.24; 1.24 date 92.09.05.23.41.36; author mao; state Exp; branches; next 1.23; 1.23 date 91.11.14.15.00.55; author jolly; state Exp; branches; next 1.22; 1.22 date 91.09.06.15.58.35; author mer; state Exp; branches; next 1.21; 1.21 date 91.03.03.13.36.56; author mao; state Exp; branches; next 1.20; 1.20 date 91.03.01.10.43.10; author mao; state Exp; branches; next 1.19; 1.19 date 91.03.01.10.26.22; author mao; state Exp; branches; next 1.18; 1.18 date 90.11.20.15.54.15; author sp; state Exp; branches; next 1.17; 1.17 date 90.09.18.21.52.25; author hong; state Exp; branches; next 1.16; 1.16 date 90.09.12.18.02.13; author cimarron; state Exp; branches; next 1.15; 1.15 date 90.08.18.00.41.02; author cimarron; state Exp; branches; next 1.14; 1.14 date 90.08.14.09.51.00; author cimarron; state Exp; branches; next 1.13; 1.13 date 90.08.08.08.25.17; author cimarron; state Exp; branches; next 1.12; 1.12 date 90.06.19.09.17.12; author cimarron; state Version_2; branches; next 1.11; 1.11 date 90.06.13.14.38.32; author cimarron; state Exp; branches; next 1.10; 1.10 date 90.04.02.11.13.17; author hong; state Exp; branches; next 1.9; 1.9 date 90.01.26.10.19.11; author cimarron; state Exp; branches; next 1.8; 1.8 date 90.01.11.17.20.29; author sp; state Exp; branches; next 1.7; 1.7 date 89.10.01.16.07.28; author hirohama; state Exp; branches; next 1.6; 1.6 date 89.09.05.17.14.01; author mao; state C_Demo_1; branches; next 1.5; 1.5 date 89.06.17.01.52.38; author hirohama; state Exp; branches; next 1.4; 1.4 date 89.02.26.16.20.25; author hirohama; state Stab; branches; next 1.3; 1.3 date 89.02.02.20.04.04; author hirohama; state Exp; branches; next 1.2; 1.2 date 89.02.02.16.30.15; author aoki; state Exp; branches; next 1.1; 1.1 date 89.01.17.05.55.31; author cimarron; state Exp; branches; next ; desc @@ 1.30 log @proto fixes @ text @/* * catalog.c -- * */ #include /* XXX */ #include "tmp/postgres.h" RcsId("$Header: /import/faerie/faerie/aoki/postgres/src/backend/catalog/RCS/catalog.c,v 1.29 1994/02/02 00:22:27 marc Exp aoki $"); #include "access/htup.h" #include "storage/buf.h" #include "utils/log.h" #include "utils/palloc.h" #include "catalog/syscache.h" #include "catalog/catname.h" /* NameIs{,Shared}SystemRelationName */ #include "catalog/pg_attribute.h" #include "catalog/pg_type.h" static n_shared = sizeof(SharedSystemRelationNames) / sizeof(Name); extern char *DataDir; #ifndef MAXPATHLEN #define MAXPATHLEN 80 #endif /* * relpath - path to the relation * Perhaps this should be in-line code in relopen(). */ char * relpath(relname) char relname[]; { char *path; if (NameIsSharedSystemRelationName((Name)relname)) { path = (char *) palloc(strlen(DataDir) + sizeof(NameData) + 2); sprintf(path, "%s/%.*s", DataDir, NAMEDATALEN, relname); return (path); } return(relname); } /* * issystem - returns non-zero iff relname is a system catalog * * We now make a new requirement where system catalog relns must begin * with pg_ while user relns are forbidden to do so. Make the test * trivial and instantaneous. * * XXX this is way bogus. -- pma */ bool issystem(relname) char relname[]; { if (relname[0] && relname[1] && relname[2]) return (relname[0] == 'p' && relname[1] == 'g' && relname[2] == '_'); else return FALSE; } bool NameIsSystemRelationName(name) Name name; { return ((bool)issystem(name)); } bool NameIsSharedSystemRelationName(relname) Name relname; { register Name *spp = SharedSystemRelationNames; register Name *mpp; int len = n_shared; int mid; int status; /* * Quick out: if it's not a system relation, it can't be a shared * system relation. */ if (!issystem(relname)) return FALSE; /* * While there's more than 2 candidates remaining, run the * binary search algorithm */ while (len > 2) { mid = len >> 1; mpp = spp + mid; if (!(status = strncmp(relname->data, (*mpp)->data, sizeof(NameData)))) { return(TRUE); } else if (status < 0) len = mid; else { spp = mpp + 1; len -= mid + 1; } } if (len <= 0) return(FALSE); if (len == 2) { if (!(status = strncmp(relname->data, (*spp)->data, sizeof(NameData)))) { return(TRUE); } else if (status < 0) return(FALSE); spp++; } return(!strncmp(relname->data, (*spp)->data, sizeof(NameData))); } /* * newoid - returns a unique identifier across all catalogs. * * Object Id allocation is now done by GetNewObjectID in * access/transam/varsup.c. oids are now allocated correctly. * * old comments: * This needs to change soon, it fails if there are too many more * than one call per second when postgres restarts after it dies. * * The distribution of OID's should be done by the POSTMASTER. * Also there needs to be a facility to preallocate OID's. Ie., * for a block of OID's to be declared as invalid ones to allow * user programs to use them for temporary object identifiers. */ ObjectId newoid() { ObjectId lastoid; GetNewObjectId(&lastoid); if (! ObjectIdIsValid(lastoid)) elog(WARN, "newoid: GetNewObjectId returns invalid oid"); return lastoid; } /* * fillatt - fills the ATTRIBUTE relation fields from the TYP * * Expects that the atttypid domain is set for each att[]. * Returns with the attnum, and attlen domains set. * attnum, attproc, atttyparg, ... should be set by the user. * * In the future, attnum may not be set?!? or may be passed as an arg?!? * * Current implementation is very inefficient--should cashe the * information if this is at all possible. * * Check to see if this is really needed, and especially in the case * of index tuples. */ fillatt(natts, att) int natts; AttributeTupleForm att[]; /* tuple desc */ { AttributeTupleForm *attributeP; register TypeTupleForm typp; HeapTuple tuple; int i; if (natts < 0 || natts > MaxHeapAttributeNumber) elog(WARN, "fillatt: %d attributes is too large", natts); if (natts == 0) { elog(DEBUG, "fillatt: called with natts == 0"); return; } attributeP = &att[0]; for (i = 0; i < natts;) { tuple = SearchSysCacheTuple(TYPOID, (char *) Int32GetDatum((*attributeP)->atttypid), (char *) NULL, (char *) NULL, (char *) NULL); if (!HeapTupleIsValid(tuple)) { elog(WARN, "fillatt: unknown atttypid %ld", (*attributeP)->atttypid); } else { (*attributeP)->attnum = (int16) ++i; /* Check if the attr is a set before messing with the length and byval, since those were already set in TupleDescInitEntry. In fact, this seems redundant here, but who knows what I'll break if I take it out... */ if (! (*attributeP)->attisset) { typp = (TypeTupleForm) GETSTRUCT(tuple); /* XXX */ (*attributeP)->attlen = typp->typlen; (*attributeP)->attbyval = typp->typbyval; } } attributeP += 1; } } @ 1.29 log @Fixes to make sure we don't expect NameData variables to be NULL terminated and that we don't write mroe than NAMEDATALEN chars into them @ text @d10 1 a10 1 RcsId("$Header: /usr/local/devel/postgres.test/src/backend/catalog/RCS/catalog.c,v 1.28 1993/09/26 00:20:22 paxson Exp marc $"); d15 1 d189 2 a190 1 (*attributeP)->atttypid, @ 1.28 log @added check in fillatt if attribute is a set, to use type of elements of set. @ text @d10 1 a10 1 RcsId("$Header: /local/src/postgres/src/backend/catalog/RCS/catalog.c,v 1.27 1993/03/17 20:04:24 aoki Exp paxson $"); d42 1 a42 1 sprintf(path, "%s/%.16s", DataDir, relname); @ 1.27 log @added the missing arguments to SearchSysCacheTuple that avi found @ text @d10 1 a10 1 RcsId("$Header: /home2/aoki/postgres/src/backend/catalog/RCS/catalog.c,v 1.26 1992/12/19 01:38:45 aoki Exp aoki $"); d187 22 a208 15 tuple = SearchSysCacheTuple(TYPOID, (*attributeP)->atttypid, (char *) NULL, (char *) NULL, (char *) NULL); if (!HeapTupleIsValid(tuple)) { elog(WARN, "fillatt: unknown atttypid %ld", (*attributeP)->atttypid); } else { typp = (TypeTupleForm) GETSTRUCT(tuple); /* XXX */ (*attributeP)->attlen = typp->typlen; (*attributeP)->attnum = (int16) ++i; (*attributeP)->attbyval = typp->typbyval; } attributeP += 1; @ 1.26 log @second checkin for acls and other stuff @ text @d10 1 a10 1 RcsId("$Header: /usr/local/dev/postgres/mastertree/newconf/RCS/catalog.c,v 1.25 1992/09/08 05:21:02 mao Exp $"); d187 5 a191 1 tuple = SearchSysCacheTuple(TYPOID, (*attributeP)->atttypid); d198 1 a198 1 (*attributeP)->attnum = (int16)++i; @ 1.25 log @return the pathname we construct in relpath() @ text @d10 1 a10 1 RcsId("$Header: /private/mao/postgres/src/lib/catalog/RCS/catalog.c,v 1.24 1992/09/05 23:41:36 mao Exp $"); d21 1 a21 36 /* * XXX The global relation names should be merged with the ones defined * XXX in lib/catalog/catname.c, someday. */ char DATABASE_R[16] = "pg_database"; char DEFAULTS_R[16] = "pg_defaults"; char DEMON_R[16] = "pg_demon"; char LOG_R[16] = "pg_log"; char MAGIC_R[16] = "pg_magic"; char SERVER_R[16] = "pg_server"; char TIME_R[16] = "pg_time"; char TYPE_R[16] = "pg_type"; char USER_R[16] = "pg_user"; char VARIABLE_R[16] = "pg_variable"; /* ---------------- * WARNING WARNING WARNING WARNING WARNING WARNING * * keep SharedSysRelns[] in SORTED order! A binary search * is done on it! * * XXX this is a serious hack which should be fixed -cim 1/26/90 * ---------------- */ static char *SharedSysRelns[] = { DATABASE_R, DEFAULTS_R, DEMON_R, LOG_R, MAGIC_R, SERVER_R, TIME_R, USER_R, VARIABLE_R, }; d55 1 d80 3 a82 3 register char **spp; register char **mpp; int len; a85 2 spp = SharedSysRelns; d87 2 a88 1 * Quick out: if its not a system reln it can't be a shared system reln. d92 1 a93 5 * Total number of Shared System relations */ len = sizeof (SharedSysRelns) / sizeof (char *); /* d100 2 a101 1 if ((status = strncmp(relname, *mpp, 16)) == 0) { d114 3 a116 2 if ((status = strncmp(relname, *spp, 16)) == 0) { return(1); d121 2 a122 1 return(strncmp(relname, *spp, 16) == 0); d144 6 a149 7 ObjectId lastoid; GetNewObjectId(&lastoid); if (! ObjectIdIsValid(lastoid)) elog(WARN, "newoid: GetNewObjectId returns invalid oid"); return lastoid; d169 2 a170 2 int natts; AttributeTupleForm att[]; /* tuple desc */ d172 26 a197 24 AttributeTupleForm *attributeP; register TypeTupleForm typp; HeapTuple tuple; int i; if (natts < 0 || natts > MaxHeapAttributeNumber) elog(WARN, "fillatt: %d attributes is too large", natts); if (natts == 0) { elog(DEBUG, "fillatt: called with natts == 0"); return; } attributeP = &att[0]; for (i = 0; i < natts;) { tuple = SearchSysCacheTuple(TYPOID, (*attributeP)->atttypid); if (!HeapTupleIsValid(tuple)) { elog(WARN, "fillatt: unknown atttypid %ld", (*attributeP)->atttypid); } else { typp = (TypeTupleForm) GETSTRUCT(tuple); /* XXX */ (*attributeP)->attlen = typp->typlen; (*attributeP)->attnum = (int16)++i; (*attributeP)->attbyval = typp->typbyval; a198 2 attributeP += 1; } @ 1.24 log @allow location of data/ to be supplied in environment or on command line @ text @d10 1 a10 1 RcsId("$Header: /private/mao/postgres/src/lib/catalog/RCS/catalog.c,v 1.23 1991/11/14 15:00:55 jolly Exp mao $"); d69 1 a69 1 char * d78 1 @ 1.23 log @cleaned up for function prototyping @ text @d10 1 a10 1 RcsId("$Header: lib/catalog/RCS/catalog.c,v 1.22 91/09/06 15:58:35 mer Exp Locker: jolly $"); d58 2 a65 6 * * Note: returns a static value. Maybe should be able to handle * temporary relations and arbitrary files (buffered psort temps) * with proper names in addition to the other standard relation * names. * d73 1 a73 2 static char path[1 + 6 + 16] = "../../"; static char *appnd = path + 6; d76 2 a77 2 strncpy(appnd, relname, 16); return(path); @ 1.22 log @Make issystem() a lot cleaner -- it simply checks for pg_ This also allowed a lot of cleaning up of the code. @ text @d10 1 a10 1 RcsId("$Header: /users/mer/postgres/src/lib/catalog/RCS/catalog.c,v 1.21 1991/03/03 13:36:56 mao Exp mer $"); d80 1 a80 1 if (NameIsSharedSystemRelationName(relname)) { @ 1.21 log @pg_relation is pg_class -- fix to ouzo three. oo sucks. @ text @d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.20 91/03/01 10:43:10 mao Exp Locker: mao $"); a25 6 char AGGREGATE_R[16] = "pg_aggregate"; char AM_R[16] = "pg_am"; char AMOP_R[16] = "pg_amop"; char AMPROC_R[16] = "pg_amproc"; char ATTRIBUTE_R[16] = "pg_attribute"; char CLASS_R[16] = "pg_class"; a28 5 char INDEX_R[16] = "pg_index"; char INHERITPROC_R[16] = "pg_inheritproc"; char INHERITS_R[16] = "pg_inherits"; char IPL_R[16] = "pg_ipl"; char LANGUAGE_R[16] = "pg_language"; a30 9 char OPCLASS_R[16] = "pg_opclass"; char OPERATOR_R[16] = "pg_operator"; char PARG_R[16] = "pg_parg"; char PROC_R[16] = "pg_proc"; char PRS2PLANS_R[16] = "pg_prs2plans"; char PRS2RULE_R[16] = "pg_prs2rule"; char PRS2STUB_R[16] = "pg_prs2stub"; char RULE_R[16] = "pg_rule"; char RULEPLANS_R[16] = "pg_ruleplans"; a31 1 char STATISTIC_R[16] = "pg_statistic"; a35 1 char VERSION_R[16] = "pg_version"; d40 1 a40 1 * keep SystemRelname[] in SORTED order! A binary search d46 1 a46 7 static char *SystemRelname[] = { AGGREGATE_R, AM_R, AMOP_R, AMPROC_R, ATTRIBUTE_R, CLASS_R, a49 5 INDEX_R, INHERITPROC_R, INHERITS_R, IPL_R, LANGUAGE_R, a51 9 OPCLASS_R, OPERATOR_R, PARG_R, PROC_R, PRS2PLANS_R, PRS2RULE_R, PRS2STUB_R, RULE_R, RULEPLANS_R, a52 1 STATISTIC_R, a53 1 TYPE_R, a55 1 VERSION_R, a57 2 static char **Spp; /* system relname pointer */ a61 35 static char IsDbdb[] = { '\0', /* AGGREGATE_R, */ '\0', /* AM_R, */ '\0', /* AMOP_R, */ '\0', /* AMPROC_R, */ '\0', /* ATTRIBUTE_R, */ '\0', /* CLASS_R, */ '\001', /* DATABASE_R, */ '\001', /* DEFAULTS_R, */ '\001', /* DEMON_R, */ '\0', /* INDEX_R, */ '\0', /* INHERITPROC_R, */ '\0', /* INHERITS_R, */ '\0', /* IPL_R, */ '\0', /* LANGUAGE_R, */ '\001', /* LOG_R, */ '\001', /* MAGIC_R, */ '\0', /* OPCLASS_R, */ '\0', /* OPERATOR_R, */ '\0', /* PARG_R, */ '\0', /* PROC_R, */ '\0', /* PRS2PLANS_R, */ '\0', /* PRS2RULE_R, */ '\0', /* PRS2STUB_R, */ '\0', /* RULE_R, */ '\0', /* RULEPLANS_R, */ '\001', /* SERVER_R, */ '\0', /* STATISTIC_R, */ '\001', /* TIME_R, */ '\0', /* TYPE_R, */ '\001', /* USER_R, */ '\001', /* VARIABLE_R, */ '\0', /* VERSION_R, */ }; d80 1 a80 1 if (issystem(relname) && IsDbdb[Spp - SystemRelname]) { d90 4 a93 3 * Uses a binary search on the SystemRelname table. Hashing would * probably be more efficient since the relation names are static. * Currently, leaves Spp pointing to the SystemRelname string. d95 1 a95 2 int d99 19 d124 16 a139 2 spp = SystemRelname; len = sizeof (SystemRelname) / sizeof (char *); d144 1 a144 2 Spp = mpp; return(1); d154 1 a154 1 return(0); a156 1 Spp = spp; d159 1 a159 1 return(0); a161 1 Spp = spp; a162 14 } bool NameIsSystemRelationName(name) Name name; { return ((bool)issystem(name)); } bool NameIsSharedSystemRelationName(name) Name name; { return ((bool)(NameIsSystemRelationName(name) && IsDbdb[Spp - SystemRelname])); @ 1.20 log @add pg_amproc while i'm thinking about it. @ text @d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.19 91/03/01 10:26:22 mao Exp Locker: mao $"); d31 1 a48 1 char RELATION_R[16] = "pg_relation"; d74 1 a91 1 RELATION_R, d115 1 a132 1 '\0', /* RELATION_R, */ @ 1.19 log @new syscache 'prs2stub' @ text @d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.18 90/11/20 15:54:15 sp Exp Locker: mao $"); d29 1 d72 1 d113 1 @ 1.18 log @"struct tuple", "struct ituple" and some hash defines (like "T_OID", "T_CTID", "MAXATTS" etc.) which used to be defined in "htup.h" are now obsolete and replaced by "HeapTuple", "IndexTuple" etc. All these new definitions are in "htup.h" and "itup.h". @ text @d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.17 90/09/18 21:52:25 hong Exp Locker: sp $"); d46 1 d88 1 d128 1 @ 1.17 log @cleaned up striping code @ text @d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.16 90/09/12 18:02:13 cimarron Exp Locker: hong $"); d278 1 a278 1 if (natts < 0 || natts > MAXATTS) @ 1.16 log @changed newoid() to call GetNewObjectId which allocates object id's correctly. @ text @d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.15 90/08/18 00:41:02 cimarron Exp Locker: cimarron $"); a148 29 #ifdef _xprs_ char * relpath(relname, stripe) char relname[]; int stripe; { static char path[1 + 6 + 16] = "../../"; static char *appnd = path + 6; static char *disks[] = { "", "/usr3/postgres/hong/stripe/", "/usr4/postgres/hong/stripe/", "/usr5/postgres/hong/stripe/", "/usr8/postgres/hong/stripe/" }; char buf[100]; if (issystem(relname)) if (IsDbdb[Spp - SystemRelname]) { strncpy(appnd, relname, 16); return(path); } else return(relname); /* system relations are not striped */ else { sprintf(buf, "%s%s", disks[stripe], relname); return(buf); } } #else /* _xprs_ */ a161 1 #endif /* _xprs_ */ @ 1.15 log @eliminated less significant .h files @ text @d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.14 90/08/14 09:51:00 cimarron Exp Locker: cimarron $"); d258 4 d274 5 a278 2 static ObjectId lastoid = InvalidObjectId; long time(); /* XXX lint */ d280 1 a280 3 if (lastoid != InvalidObjectId) return(++lastoid); return(lastoid = time((long *)0)); @ 1.14 log @added pathnames to header includes and reorganized some #include files. @ text @d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.13 90/08/08 08:25:17 cimarron Exp Locker: cimarron $"); a14 1 #include "tmp/name.h" @ 1.13 log @reorganized some header files @ text @d8 1 a8 1 #include "postgres.h" d10 1 a10 1 RcsId("$Header: RCS/catalog.c,v 1.12 90/06/19 09:17:12 cimarron Version_2 Locker: cimarron $"); d12 4 a15 1 #include "catname.h" /* XXX for definitions of NameIs{,Shared}SystemRelationName */ d17 2 a18 7 #include "buf.h" #include "htup.h" #include "log.h" #include "name.h" #include "syscache.h" #include "htup.h" @ 1.12 log @reorginized code and added support for relation types @ text @d6 1 a6 1 #include "c.h" d8 1 a8 1 RcsId("$Header: RCS/catalog.c,v 1.11 90/06/13 14:38:32 cimarron Exp $"); d10 2 a11 1 #include /* XXX */ a14 1 #include "cat.h" a17 1 #include "oid.h" d20 3 @ 1.11 log @removed dependency on tuple.h which has been obsoleted. @ text @d8 1 a8 1 RcsId("$Header: RCS/catalog.c,v 1.10 90/04/02 11:13:17 hong Exp $"); d296 2 a297 2 int natts; AttributeTupleForm att[]; /* tuple desc */ d299 4 a302 4 AttributeTupleForm *attributeP; register TypeTupleForm typp; HeapTuple tuple; int i; d304 6 a309 6 if (natts < 0 || natts > MAXATTS) elog(WARN, "fillatt: %d attributes is too large", natts); if (natts == 0) { elog(DEBUG, "fillatt: called with natts == 0"); return; } d311 1 a311 1 attributeP = &att[0]; d313 10 a322 11 for (i = 0; i < natts;) { tuple = SearchSysCacheTuple(TYPOID, (*attributeP)->atttypid); if (!HeapTupleIsValid(tuple)) { elog(WARN, "fillatt: unknown atttypid %ld", (*attributeP)->atttypid); } typp = (TypeTupleForm)GETSTRUCT(tuple); /* XXX */ (*attributeP)->attlen = typp->typlen; (*attributeP)->attnum = (int16)++i; (*attributeP)->attbyval = typp->typbyval; attributeP += 1; d324 2 @ 1.10 log @added #ifdef options for striping @ text @d8 1 a8 1 RcsId("$Header: RCS/catalog.c,v 1.9 90/01/26 10:19:11 cimarron Exp $"); d20 1 a20 1 #include "tuple.h" /* XXX OBSOLETE, for MAXATTS, etc. */ @ 1.9 log @reordered SystemRelname[] and cleaned up IsDbdb[] -cim @ text @d8 1 a8 1 RcsId("$Header: RCS/catalog.c,v 1.9 90/01/26 10:14:06 cimarron Exp $"); d150 1 d152 1 a152 1 relpath(relname) d154 1 d158 7 d166 2 a167 1 if (issystem(relname) && IsDbdb[Spp - SystemRelname]) { d170 6 a176 1 return(relname); d178 15 @ 1.8 log @New system relations 'Prs2Rule' and 'Prs2Plans' defined @ text @d8 1 a8 1 RcsId("$Header: RCS/catalog.c,v 1.7 89/10/01 16:07:28 hirohama Exp $"); d27 30 a56 30 char AGGREGATE_R[16] = "pg_aggregate"; char AM_R[16] = "pg_am"; char AMOP_R[16] = "pg_amop"; char ATTRIBUTE_R[16] = "pg_attribute"; char DATABASE_R[16] = "pg_database"; char DEFAULTS_R[16] = "pg_defaults"; char DEMON_R[16] = "pg_demon"; char INDEX_R[16] = "pg_index"; char INHERITPROC_R[16] = "pg_inheritproc"; char INHERITS_R[16] = "pg_inherits"; char IPL_R[16] = "pg_ipl"; char LANGUAGE_R[16] = "pg_language"; char LOG_R[16] = "pg_log"; char MAGIC_R[16] = "pg_magic"; char OPCLASS_R[16] = "pg_opclass"; char OPERATOR_R[16] = "pg_operator"; char PARG_R[16] = "pg_parg"; char PROC_R[16] = "pg_proc"; char PRS2RULE_R[16] = "pg_prs2rule"; char PRS2PLANS_R[16] = "pg_prs2plans"; char RELATION_R[16] = "pg_relation"; char RULE_R[16] = "pg_rule"; char RULEPLANS_R[16] = "pg_ruleplans"; char SERVER_R[16] = "pg_server"; char STATISTIC_R[16] = "pg_statistic"; char TIME_R[16] = "pg_time"; char TYPE_R[16] = "pg_type"; char USER_R[16] = "pg_user"; char VARIABLE_R[16] = "pg_variable"; char VERSION_R[16] = "pg_version"; d58 40 a97 6 static char *SystemRelname[] = { AGGREGATE_R, AM_R, AMOP_R, ATTRIBUTE_R, DATABASE_R, DEFAULTS_R, DEMON_R, INDEX_R, INHERITPROC_R, INHERITS_R, IPL_R, LANGUAGE_R, LOG_R, MAGIC_R, OPCLASS_R, OPERATOR_R, PARG_R, PROC_R, PRS2RULE_R, PRS2PLANS_R, RELATION_R, RULE_R, RULEPLANS_R, SERVER_R, STATISTIC_R, TIME_R, TYPE_R, USER_R, VARIABLE_R, VERSION_R, d107 30 a136 5 '\0', '\0', '\0', '\0', '\001', '\001', '\001', '\0', '\0', '\0', '\0', '\0', '\001', '\001', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\001', '\0', '\001', '\0', '\001', '\001', '\0', @ 1.7 log @fillatt now uses the catalog cache Note: this is not cause a bootstrapping problem since it is not called during the early phases of the catalog creation processing @ text @d8 1 a8 1 RcsId("$Header: RCS/catalog.c,v 1.6 89/09/05 17:14:01 mao C_Demo_1 Locker: hirohama $"); d45 2 d61 3 a63 2 OPCLASS_R, OPERATOR_R, PARG_R, PROC_R, RELATION_R, RULE_R, RULEPLANS_R, SERVER_R, STATISTIC_R, TIME_R, TYPE_R, USER_R, VARIABLE_R, VERSION_R d75 3 a77 2 '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\001', '\0', '\001', '\0', '\001', '\001', '\0' @ 1.6 log @Working version of C-only demo @ text @d1 4 a4 1 static char catalog_c[] = "$Header: /usr6/postgres/mao/postgres/src/lib/catalog/RCS/catalog.c,v 1.5 89/06/17 01:52:38 hirohama Exp $"; d6 5 a10 3 #include #include #include "access.h" a11 3 #include "fmgr.h" #include "log.h" #include "name.h" a12 2 #include "c.h" d15 3 d19 2 a20 1 #include "trange.h" a22 4 * catalog.c - system catalog utility functions */ /* d203 2 a204 2 int natts; struct attribute *att[]; d206 1 a206 1 register struct attribute **attp; d208 2 a209 9 struct skey key; TUPLE *tup; struct reldesc *rdesc; struct relscan *sdesc; int i; struct reldesc *amopenr(); struct relscan *ambeginscan(); TUPLE *amgetnext(); extern amendscan(), amclose(); d217 3 a219 6 /* XXX catcache */ rdesc = amopenr(TYPE_R); key.sk_flags = 0; key.sk_attnum = T_OID; /* typid */ key.sk_opr = F_INT4EQ; attp = att; d221 4 a224 7 key.sk_data = (DATUM)(*attp)->atttypid; sdesc = ambeginscan(rdesc, 0, DefaultTimeRange, 1, &key); tup = (TUPLE *)amgetnext(sdesc, 0, (Buffer *)NULL); if (!PointerIsValid(tup)) { elog(WARN, "fillatt: unknown atttypid %ld", (long)key.sk_data); d226 5 a230 6 typp = (TypeTupleForm)GETSTRUCT((&tup->tp_t)); /* XXX */ (*attp)->attlen = typp->typlen; (*attp)->attnum = (int16)++i; (*attp)->attbyval = typp->typbyval; amendscan(sdesc); attp++; a231 1 amclose(rdesc); @ 1.5 log @*** empty log message *** @ text @d1 1 a1 1 static char catalog_c[] = "$Header: /usr6/postgres/hirohama/postgres/src/lib/catalog/RCS/catalog.c,v 1.4 89/02/26 16:20:25 hirohama Stab $"; @ 1.4 log @added RULEPLANS_R @ text @d1 1 a1 1 static char catalog_c[] = "$Header: catalog.c,v 1.3 89/02/02 20:04:04 hirohama Locked $"; a6 1 #include "context.h" @ 1.3 log @added a #include @ text @d1 1 a1 1 static char catalog_c[] = "$Header: catalog.c,v 1.2 89/02/02 16:30:15 hirohama Locked $"; d23 5 d48 1 d60 2 a61 2 OPCLASS_R, OPERATOR_R, PARG_R, PROC_R, RELATION_R, RULE_R, SERVER_R, STATISTIC_R, TIME_R, TYPE_R, USER_R, VARIABLE_R, VERSION_R d73 2 a74 2 '\0', '\0', '\0', '\0', '\0', '\0', '\001', '\0', '\001', '\0', '\001', '\001', '\0' @ 1.2 log @MERGE WITH OLD TREE @ text @d1 1 a1 1 static char catalog_c[] = "$Header: catalog.c,v 2.11 89/01/24 20:20:17 aoki Locked $"; d15 1 @ 1.1 log @Initial revision @ text @d1 1 a2 28 /* * * POSTGRES Data Base Management System * * Copyright (c) 1988 Regents of the University of California * * Permission to use, copy, modify, and distribute this software and its * documentation for educational, research, and non-profit purposes and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of the University of California not be used in advertising * or publicity pertaining to distribution of the software without * specific, written prior permission. Permission to incorporate this * software into commercial products can be obtained from the Campus * Software Office, 295 Evans Hall, University of California, Berkeley, * Ca., 94720 provided only that the the requestor give the University * of California a free licence to any derived software for educational * and research purposes. The University of California makes no * representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied warranty. * */ static char catalog_c[] = "$Header: catalog.c,v 1.1 88/11/11 16:42:09 postgres Exp $"; d200 2 a201 2 register struct attribute **attp; register struct type *typp; d233 1 a233 1 typp = (struct type *)GETSTRUCT((&tup->tp_t)); /* XXX */ @