From d0471244e62ee530f6eb2a840add4344cc7327d1 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 17 Nov 1997 16:59:36 +0000 Subject: [PATCH] Remove 16 char limit on system table/index names. Rename system indexes. --- src/backend/bootstrap/bootstrap.c | 6 +-- src/backend/commands/view.c | 16 +------- src/backend/parser/parser.c | 4 +- src/backend/utils/cache/inval.c | 4 +- src/backend/utils/cache/lsyscache.c | 4 +- src/backend/utils/cache/relcache.c | 4 +- src/include/catalog/indexing.h | 63 +++++++++++++++-------------- src/include/catalog/pg_proc.h | 3 +- 8 files changed, 46 insertions(+), 58 deletions(-) diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c index 7ad0c5c019..29409a733d 100644 --- a/src/backend/bootstrap/bootstrap.c +++ b/src/backend/bootstrap/bootstrap.c @@ -7,7 +7,7 @@ * Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.26 1997/09/18 20:20:04 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.27 1997/11/17 16:58:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -480,8 +480,8 @@ boot_openrel(char *relname) HeapScanDesc sdesc; HeapTuple tup; - if (strlen(relname) > 15) - relname[15] = '\000'; + if (strlen(relname) >= NAMEDATALEN-1) + relname[NAMEDATALEN-1] = '\0'; if (Typ == (struct typmap **) NULL) { diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c index 1af5a2cb86..ca4ff5a942 100644 --- a/src/backend/commands/view.c +++ b/src/backend/commands/view.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.12 1997/09/18 20:20:27 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.13 1997/11/17 16:58:59 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -117,28 +117,16 @@ DefineVirtualRelation(char *relname, List *tlist) * Given a view name, returns the name for the 'on retrieve to "view"' * rule. * This routine is called when defining/removing a view. - * - * NOTE: it quarantees that the name is at most 15 chars long - * - * XXX it also means viewName cannot be 16 chars long! - ay 11/94 *------------------------------------------------------------------ */ char * MakeRetrieveViewRuleName(char *viewName) { -/* - char buf[100]; - - MemSet(buf, 0, sizeof(buf)); - sprintf(buf, "_RET%.*s", NAMEDATALEN, viewName->data); - buf[15] = '\0'; - namestrcpy(rule_name, buf); -*/ - char *buf; buf = palloc(strlen(viewName) + 5); sprintf(buf, "_RET%s", viewName); + return buf; } diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c index 18adb97131..a70c90ea6c 100644 --- a/src/backend/parser/parser.c +++ b/src/backend/parser/parser.c @@ -6,7 +6,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.26 1997/09/12 04:08:01 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.27 1997/11/17 16:59:08 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -216,7 +216,7 @@ parser_typecast(Value *expr, TypeName *typename, int typlen) Const *adt; Datum lcp; Type tp; - char type_string[16]; + char type_string[NAMEDATALEN]; int32 len; char *cp = NULL; char *const_string = NULL; diff --git a/src/backend/utils/cache/inval.c b/src/backend/utils/cache/inval.c index b1017fe4f3..e7b44380ab 100644 --- a/src/backend/utils/cache/inval.c +++ b/src/backend/utils/cache/inval.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.8 1997/09/08 21:48:50 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/inval.c,v 1.9 1997/11/17 16:59:22 momjian Exp $ * * Note - this code is real crufty... * @@ -591,7 +591,7 @@ SetRefreshWhenInvalidate(bool on) */ #ifdef INVALIDDEBUG #define RelationInvalidateHeapTuple_DEBUG1 \ -elog(DEBUG, "RelationInvalidateHeapTuple(%.16s, [%d,%d])", \ +elog(DEBUG, "RelationInvalidateHeapTuple(%s, [%d,%d])", \ RelationGetRelationName(relation), \ ItemPointerGetBlockNumber(&tuple->t_ctid), \ ItemPointerGetOffsetNumber(&tuple->t_ctid)) diff --git a/src/backend/utils/cache/lsyscache.c b/src/backend/utils/cache/lsyscache.c index 060a7b2a89..26980c6e2e 100644 --- a/src/backend/utils/cache/lsyscache.c +++ b/src/backend/utils/cache/lsyscache.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.6 1997/09/08 21:48:51 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/lsyscache.c,v 1.7 1997/11/17 16:59:23 momjian Exp $ * * NOTES * Eventually, the index information should go through here, too. @@ -148,7 +148,7 @@ get_attisset(Oid relid, char *attname) PointerGetDatum(attname), 0, 0); if (!HeapTupleIsValid(htup)) - elog(WARN, "get_attisset: no attribute %.16s in relation %d", + elog(WARN, "get_attisset: no attribute %s in relation %d", attname, relid); if (heap_attisnull(htup, attno)) return (false); diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c index 90cb42d320..046cba3458 100644 --- a/src/backend/utils/cache/relcache.c +++ b/src/backend/utils/cache/relcache.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.27 1997/11/02 15:26:06 vadim Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.28 1997/11/17 16:59:25 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -366,7 +366,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo) case INFO_RELNAME: ScanKeyEntryInitialize(&key, 0, Anum_pg_class_relname, - Character16EqualRegProcedure, + NameEqualRegProcedure, NameGetDatum(buildinfo.i.info_name)); break; diff --git a/src/include/catalog/indexing.h b/src/include/catalog/indexing.h index 5adef2d9e0..aeed890803 100644 --- a/src/include/catalog/indexing.h +++ b/src/include/catalog/indexing.h @@ -7,7 +7,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: indexing.h,v 1.11 1997/11/15 20:57:38 momjian Exp $ + * $Id: indexing.h,v 1.12 1997/11/17 16:59:34 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -27,26 +27,26 @@ #define Num_pg_attrdef_indices 1 #define Num_pg_relcheck_indices 1 #define Num_pg_trigger_indices 1 -#define Num_pg_objoid_indices 1 +#define Num_pg_description_indices 1 /* * Names of indices on system catalogs */ -#define AttributeNameIndex "pg_attnameind" -#define AttributeNumIndex "pg_attnumind" -#define AttributeRelidIndex "pg_attrelidind" -#define ProcedureNameIndex "pg_procnameind" -#define ProcedureOidIndex "pg_procidind" -#define ProcedureSrcIndex "pg_procsrcind" -#define TypeNameIndex "pg_typenameind" -#define TypeOidIndex "pg_typeidind" -#define ClassNameIndex "pg_classnameind" -#define ClassOidIndex "pg_classoidind" -#define AttrDefaultIndex "pg_attrdefind" -#define RelCheckIndex "pg_relcheckind" -#define TriggerRelidIndex "pg_trigrelidind" -#define DescriptionObjIndex "pg_descrobjind" +#define AttributeNameIndex "pg_attribute_mkoidname_index" +#define AttributeNumIndex "pg_attribute_mkoidint2_index" +#define AttributeRelidIndex "pg_attribute_attrelid_index" +#define ProcedureOidIndex "pg_proc_oid_index" +#define ProcedureNameIndex "pg_proc_proname_index" +#define ProcedureSrcIndex "pg_proc_prosrc_index" +#define TypeOidIndex "pg_type_oid_index" +#define TypeNameIndex "pg_type_typname_index" +#define ClassOidIndex "pg_class_oid_index" +#define ClassNameIndex "pg_class_relname_index" +#define AttrDefaultIndex "pg_attrdef_adrelid_index" +#define RelCheckIndex "pg_relcheck_rcrelid_index" +#define TriggerRelidIndex "pg_trigger_tgrelid_index" +#define DescriptionObjIndex "pg_description_objoid_index" extern char *Name_pg_attr_indices[]; extern char *Name_pg_proc_indices[]; @@ -55,7 +55,7 @@ extern char *Name_pg_class_indices[]; extern char *Name_pg_attrdef_indices[]; extern char *Name_pg_relcheck_indices[]; extern char *Name_pg_trigger_indices[]; -extern char *Name_pg_objoid_indices[]; +extern char *Name_pg_description_indices[]; extern char *IndexedCatalogNames[]; @@ -100,26 +100,27 @@ extern HeapTuple ClassOidIndexScan(Relation heapRelation, Oid relId); * The keyword is DECLARE_INDEX every thing after that is just like in a * normal specification of the 'define index' POSTQUEL command. */ -DECLARE_INDEX(pg_attnameind on pg_attribute using btree(mkoidname(attrelid, attname) oidname_ops)); -DECLARE_INDEX(pg_attnumind on pg_attribute using btree(mkoidint2(attrelid, attnum) oidint2_ops)); -DECLARE_INDEX(pg_attrelidind on pg_attribute using btree(attrelid oid_ops)); +DECLARE_INDEX(pg_attribute_mkoidname_index on pg_attribute using btree(mkoidname(attrelid, attname) oidname_ops)); +DECLARE_INDEX(pg_attribute_mkoidint2_index on pg_attribute using btree(mkoidint2(attrelid, attnum) oidint2_ops)); +DECLARE_INDEX(pg_attribute_attrelid_index on pg_attribute using btree(attrelid oid_ops)); -DECLARE_INDEX(pg_procidind on pg_proc using btree(Oid oid_ops)); -DECLARE_INDEX(pg_procnameind on pg_proc using btree(proname name_ops)); -DECLARE_INDEX(pg_procsrcind on pg_proc using btree(prosrc text_ops)); +DECLARE_INDEX(pg_proc_oid_index on pg_proc using btree(oid oid_ops)); +DECLARE_INDEX(pg_proc_proname_index on pg_proc using btree(proname name_ops)); +DECLARE_INDEX(pg_proc_prosrc_index on pg_proc using btree(prosrc text_ops)); -DECLARE_INDEX(pg_typeidind on pg_type using btree(Oid oid_ops)); -DECLARE_INDEX(pg_typenameind on pg_type using btree(typname name_ops)); +DECLARE_INDEX(pg_type_oid_index on pg_type using btree(oid oid_ops)); +DECLARE_INDEX(pg_type_typname_index on pg_type using btree(typname name_ops)); -DECLARE_INDEX(pg_classnameind on pg_class using btree(relname name_ops)); -DECLARE_INDEX(pg_classoidind on pg_class using btree(Oid oid_ops)); +DECLARE_INDEX(pg_class_oid_index on pg_class using btree(oid oid_ops)); +DECLARE_INDEX(pg_class_relname_index on pg_class using btree(relname name_ops)); -DECLARE_INDEX(pg_attrdefind on pg_attrdef using btree(adrelid oid_ops)); -DECLARE_INDEX(pg_relcheckind on pg_relcheck using btree(rcrelid oid_ops)); +DECLARE_INDEX(pg_attrdef_adrelid_index on pg_attrdef using btree(adrelid oid_ops)); -DECLARE_INDEX(pg_trigrelidind on pg_trigger using btree(tgrelid oid_ops)); +DECLARE_INDEX(pg_relcheck_rcrelid_index on pg_relcheck using btree(rcrelid oid_ops)); -DECLARE_INDEX(pg_descrobjind on pg_description using btree(objoid oid_ops)); +DECLARE_INDEX(pg_trigger_tgrelid_index on pg_trigger using btree(tgrelid oid_ops)); + +DECLARE_INDEX(pg_description_objoid_index on pg_description using btree(objoid oid_ops)); /* now build indices in the initialization scripts */ BUILD_INDICES diff --git a/src/include/catalog/pg_proc.h b/src/include/catalog/pg_proc.h index 944b2a4255..6bfc903075 100644 --- a/src/include/catalog/pg_proc.h +++ b/src/include/catalog/pg_proc.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: pg_proc.h,v 1.36 1997/11/15 16:32:09 momjian Exp $ + * $Id: pg_proc.h,v 1.37 1997/11/17 16:59:36 momjian Exp $ * * NOTES * The script catalog/genbki.sh reads this file and generates .bki @@ -878,7 +878,6 @@ DATA(insert OID = 484 ( char2ge PGUID 11 f t f 2 f 16 "409 409" 100 0 0 100 DESCR(""); DATA(insert OID = 1275 ( char16eq PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); DESCR(""); -#define Character16EqualRegProcedure 1275 DATA(insert OID = 1276 ( char16lt PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar )); DESCR(""); DATA(insert OID = 1277 ( char16le PGUID 11 f t f 2 f 16 "19 19" 100 0 0 100 foo bar ));