> Now I see that BufFileCreateShared() has similar problem with file->name.
Right. > More generic problem I see is that the common initialization of BufFile is > repeated a few times. The attached patch tries to improve that (it also fixes > the duplicate allocation of file->name). The changes were made by this commit to add infrastructure for sharing temporary files between backends, according to the author (Thomas Munro). https://git.postgresql.org/pg/commitdiff/dc6c4c9dc2a111519b76b22daaaac86c5608223b Your proposal looks reasonable but I would like to hear from Thomas's opinion as well. Thomas? Best regards, -- Tatsuo Ishii SRA OSS, Inc. Japan English: http://www.sraoss.co.jp/index_en.php Japanese:http://www.sraoss.co.jp