]> granicus.if.org Git - postgresql/commit
Make BufFileCreateTemp() ensure that temp tablespaces are set up.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 May 2019 17:51:16 +0000 (13:51 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 18 May 2019 17:51:16 +0000 (13:51 -0400)
commit93f03dad824f14f40519597e5e4a8fe7b6df858e
tree2276c201ef96c9230294123e60bb8f1478321574
parentb12db9ff5f09dc60dc05d0e208a5b28728970e55
Make BufFileCreateTemp() ensure that temp tablespaces are set up.

If PrepareTempTablespaces() has never been called in the current
transaction, OpenTemporaryFile() will fall back to using the default
tablespace, which is a bug if the user wanted temp files placed elsewhere.
gistInitBuildBuffers() appears to have this disease already, and it
seems like an easy trap for future coders to fall into.

We discussed other ways to close this gap, but none of them are prettier
or 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, but
nobody 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
src/backend/storage/file/buffile.c