Skip to content

Commit 3498ea8

Browse files
author
Hiroshi Inoue
committed
Improve the following.
=# create table t (id int4 unique); NOTICE: CREATE TABLE/UNIQUE will create implicit index 't_id_key' for table 't' =# begin; query: drop table t; NOTICE: Caution: DROP TABLE cannot be rolled back, so don't abort now NOTICE: Caution: DROP INDEX cannot be rolled back, so don't abort now =# rollback; =# drop table t; NOTICE: mdopen: couldn't open t: No such file or directory NOTICE: RelationIdBuildRelation: smgropen(t): No such file or directory NOTICE: mdopen: couldn't open t: No such file or directory NOTICE: mdopen: couldn't open t: No such file or directory NOTICE: mdopen: couldn't open t_id_key: No such file or directory NOTICE: RelationIdBuildRelation: smgropen(t_id_key): No such file or directory NOTICE: mdopen: couldn't open t: No such file or directory NOTICE: RelationIdBuildRelation: smgropen(t): No such file or directory NOTICE: mdopen: couldn't open t: No such file or directory ERROR: cannot open relation t
1 parent 67cd018 commit 3498ea8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/utils/cache/relcache.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.109 2000/08/06 04:39:03 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.110 2000/08/30 08:48:55 inoue Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1595,7 +1595,10 @@ RelationClearRelation(Relation relation, bool rebuildIt)
15951595
* this is kind of expensive, but I think we must do it in case
15961596
* relation has been truncated...
15971597
*/
1598-
relation->rd_nblocks = RelationGetNumberOfBlocks(relation);
1598+
if (relation->rd_unlinked)
1599+
relation->rd_nblocks = 0;
1600+
else
1601+
relation->rd_nblocks = RelationGetNumberOfBlocks(relation);
15991602

16001603
if (relDescChanged && !RelationHasReferenceCountZero(relation))
16011604
elog(ERROR, "RelationClearRelation: relation %u modified while in use",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy