pgsql: Make BufFileCreateTemp() ensure that temp tablespaces are set up

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make BufFileCreateTemp() ensure that temp tablespaces are set up
Date: 2019-05-18 17:51:33
Message-ID: E1hS3Ub-0008IU-Rt@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/93f03dad824f14f40519597e5e4a8fe7b6df858e

Modified Files
--------------
src/backend/storage/file/buffile.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2019-05-19 00:16:55 pgsql: ANSI-ify a few straggler K&R-style function definitions.
Previous Message Bruce Momjian 2019-05-18 13:23:33 pgsql: docs: tighten up PG 12 release note item on 1k partitions