Index: src/backend/commands/rename.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/commands/rename.c,v retrieving revision 1.57 diff -r1.57 rename.c 35a36,37 > static void > update_indexed_attnames(Oid indrelid, const char *_old, const char *_new); 169a172,235 > > update_indexed_attnames(relid,oldattname,newattname); > > } > > /* man, I want some sql here... > * > * UPDATE pg_attribute > * SET attname='$3' > * WHERE indrelid=$1 AND attname='$2' > */ > static void > update_indexed_attnames(Oid indrelid, > const char *oldattname, > const char *newattname) > { > List *indexoidlist; > List *indexoidscan; > Relation relation; > Relation attrelation; > > relation = heap_open(indrelid, AccessShareLock); > indexoidlist = RelationGetIndexList(relation); > > attrelation = heap_openr(AttributeRelationName, RowExclusiveLock); > > foreach(indexoidscan, indexoidlist) > { > HeapTuple atttup; > Oid indexoid; > indexoid = lfirsti(indexoidscan); > elog(DEBUG,"update_indexed_attnames: indexoid: %d", indexoid); > atttup = SearchSysCacheCopy(ATTNAME, > ObjectIdGetDatum(indexoid), > PointerGetDatum(oldattname), > 0, 0); > if (!HeapTupleIsValid(atttup)){ > elog(DEBUG, "update_indexed_attnames: not updating %d.", indexoid); > } > else{ > elog(DEBUG, "update_indexed_attnames: updating %d.", indexoid); > > > StrNCpy(NameStr(((Form_pg_attribute) GETSTRUCT(atttup))->attname), > newattname, NAMEDATALEN); > > simple_heap_update(attrelation, &atttup->t_self, atttup); > > /* keep system catalog indices current */ > { > Relation irelations[Num_pg_attr_indices]; > > CatalogOpenIndices(Num_pg_attr_indices, Name_pg_attr_indices, irelations); > CatalogIndexInsert(irelations, Num_pg_attr_indices, attrelation, atttup); > CatalogCloseIndices(Num_pg_attr_indices, irelations); > } > heap_freetuple(atttup); > } > } > > freeList(indexoidlist); > > heap_close(attrelation, RowExclusiveLock); > heap_close(relation, AccessShareLock);