Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit93f03da

Browse files
committed
Make BufFileCreateTemp() ensure that temp tablespaces are set up.
If PrepareTempTablespaces() has never been called in the currenttransaction, OpenTemporaryFile() will fall back to using the defaulttablespace, which is a bug if the user wanted temp files placed elsewhere.gistInitBuildBuffers() appears to have this disease already, and itseems like an easy trap for future coders to fall into.We discussed other ways to close this gap, but none of them are prettieror more reliable than just having BufFileCreateTemp do it. In particular,having fd.c do this creates layering issues that we could do without.Per suggestion from Melanie Plageman. Arguably this is a bug fix, butnobody seems very excited about back-patching, so change in HEAD only.Discussion:https://postgr.es/m/CAAKRu_YwzjuGAmmaw4-8XO=OVFGR1QhY_Pq-t3wjb9ribBJb_Q@mail.gmail.com
1 parentb12db9f commit93f03da

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

‎src/backend/storage/file/buffile.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
#include"postgres.h"
4343

44+
#include"commands/tablespace.h"
4445
#include"executor/instrument.h"
4546
#include"miscadmin.h"
4647
#include"pgstat.h"
@@ -185,6 +186,17 @@ BufFileCreateTemp(bool interXact)
185186
BufFile*file;
186187
Filepfile;
187188

189+
/*
190+
* Ensure that temp tablespaces are set up for OpenTemporaryFile to use.
191+
* Possibly the caller will have done this already, but it seems useful to
192+
* double-check here. Failure to do this at all would result in the temp
193+
* files always getting placed in the default tablespace, which is a
194+
* pretty hard-to-detect bug. Callers may prefer to do it earlier if they
195+
* want to be sure that any required catalog access is done in some other
196+
* resource context.
197+
*/
198+
PrepareTempTablespaces();
199+
188200
pfile=OpenTemporaryFile(interXact);
189201
Assert(pfile >=0);
190202

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp