]> granicus.if.org Git - postgresql/commitdiff
Remove the correct pgstat file on DROP DATABASE
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 5 Mar 2014 16:03:29 +0000 (13:03 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 5 Mar 2014 16:03:29 +0000 (13:03 -0300)
We were unlinking the permanent file, not the non-permanent one.  But
since the stat collector already unlinks all permanent files on startup,
there was nothing for it to unlink.  The non-permanent file remained in
place, and was copied to the permanent directory on shutdown, so in
effect no file was ever dropped.

Backpatch to 9.3, where the issue was introduced by commit 187492b6c2e8.
Before that, there were no per-database files and thus no file to drop
on DROP DATABASE.

Per report from Thom Brown.

Author: Tomáš Vondra

src/backend/postmaster/pgstat.c

index 57176ef5a98469c0f26425c27c3267b67143695a..0fd44957d96cf6b51032424e8dca44ad92954684 100644 (file)
@@ -4650,7 +4650,7 @@ pgstat_recv_dropdb(PgStat_MsgDropdb *msg, int len)
        {
                char            statfile[MAXPGPATH];
 
-               get_dbstat_filename(true, false, dbid, statfile, MAXPGPATH);
+               get_dbstat_filename(false, false, dbid, statfile, MAXPGPATH);
 
                elog(DEBUG2, "removing %s", statfile);
                unlink(statfile);