88 *
99 *
1010 * IDENTIFICATION
11- * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.167 2001/06/12 05:55:49 tgl Exp $
11+ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.168 2001/06/18 16:13:21 momjian Exp $
1212 *
1313 *
1414 * INTERFACE ROUTINES
@@ -281,8 +281,8 @@ heap_create(char *relname,
281281 * replace relname of caller with a unique name for a temp
282282 * relation
283283 */
284- snprintf (relname ,NAMEDATALEN ,"pg_temp.%d. %u" ,
285- (int )MyProcPid ,uniqueId ++ );
284+ snprintf (relname ,NAMEDATALEN ,"%s_%d_ %u" ,
285+ PG_TEMP_REL_PREFIX , (int )MyProcPid ,uniqueId ++ );
286286}
287287
288288/*
@@ -874,37 +874,6 @@ heap_create_with_catalog(char *relname,
874874}
875875
876876
877- /* ----------------------------------------------------------------
878- *heap_drop_with_catalog- removes all record of named relation from catalogs
879- *
880- *1)open relation, check for existence, etc.
881- *2)remove inheritance information
882- *3)remove indexes
883- *4)remove pg_class tuple
884- *5)remove pg_attribute tuples and related descriptions
885- *6)remove pg_description tuples
886- *7)remove pg_type tuples
887- *8)RemoveConstraints ()
888- *9)unlink relation
889- *
890- * old comments
891- *Except for vital relations, removes relation from
892- *relation catalog, and related attributes from
893- *attribute catalog (needed?). (Anything else?)
894- *
895- *get proper relation from relation catalog (if not arg)
896- *scan attribute catalog deleting attributes of reldesc
897- *(necessary?)
898- *delete relation from relation catalog
899- *(How are the tuples of the relation discarded?)
900- *
901- *XXX Must fix to work with indexes.
902- *There may be a better order for doing things.
903- *Problems with destroying a deleted database--cannot create
904- *a struct reldesc without having an open file descriptor.
905- * ----------------------------------------------------------------
906- */
907-
908877/* --------------------------------
909878 *RelationRemoveInheritance
910879 *
@@ -1334,10 +1303,35 @@ DeleteTypeTuple(Relation rel)
13341303heap_close (pg_type_desc ,RowExclusiveLock );
13351304}
13361305
1337- /* --------------------------------
1338- *heap_drop_with_catalog
1306+ /* ----------------------------------------------------------------
1307+ *heap_drop_with_catalog- removes all record of named relation from catalogs
13391308 *
1340- * --------------------------------
1309+ *1)open relation, check for existence, etc.
1310+ *2)remove inheritance information
1311+ *3)remove indexes
1312+ *4)remove pg_class tuple
1313+ *5)remove pg_attribute tuples and related descriptions
1314+ *6)remove pg_description tuples
1315+ *7)remove pg_type tuples
1316+ *8)RemoveConstraints ()
1317+ *9)unlink relation
1318+ *
1319+ * old comments
1320+ *Except for vital relations, removes relation from
1321+ *relation catalog, and related attributes from
1322+ *attribute catalog (needed?). (Anything else?)
1323+ *
1324+ *get proper relation from relation catalog (if not arg)
1325+ *scan attribute catalog deleting attributes of reldesc
1326+ *(necessary?)
1327+ *delete relation from relation catalog
1328+ *(How are the tuples of the relation discarded?)
1329+ *
1330+ *XXX Must fix to work with indexes.
1331+ *There may be a better order for doing things.
1332+ *Problems with destroying a deleted database--cannot create
1333+ *a struct reldesc without having an open file descriptor.
1334+ * ----------------------------------------------------------------
13411335 */
13421336void
13431337heap_drop_with_catalog (const char * relname ,
@@ -1360,8 +1354,10 @@ heap_drop_with_catalog(const char *relname,
13601354 * prevent deletion of system relations
13611355 */
13621356/* allow temp of pg_class? Guess so. */
1363- if (!istemp && !allow_system_table_mods &&
1364- IsSystemRelationName (RelationGetRelationName (rel )))
1357+ if (!istemp &&
1358+ !allow_system_table_mods &&
1359+ IsSystemRelationName (RelationGetRelationName (rel ))&&
1360+ !is_temp_relname (RelationGetRelationName (rel )))
13651361elog (ERROR ,"System relation \"%s\" may not be dropped" ,
13661362RelationGetRelationName (rel ));
13671363