Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9iHl-0005Ru-L6; Thu, 06 Sep 2012 20:02:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9iHi-00024B-5I; Thu, 06 Sep 2012 20:02:45 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q86K2dcd025629; Thu, 6 Sep 2012 16:02:39 -0400 (EDT) From: Tom Lane To: Robert Haas cc: Bruce Momjian , David Schnur , pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: [ADMIN] Repeatable crash in pg_dump (with -d2 info) In-reply-to: References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> <29791.1322528434@sss.pgh.pa.us> <20120827135852.GG11088@momjian.us> Comments: In-reply-to Robert Haas message dated "Thu, 06 Sep 2012 14:45:05 -0400" Date: Thu, 06 Sep 2012 16:02:39 -0400 Message-ID: <25628.1346961759@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201209/47 X-Sequence-Number: 34042 Robert Haas writes: > On Mon, Aug 27, 2012 at 9:58 AM, Bruce Momjian wrote: >> From Tom Lane in the above thread: >>> Hmm. I can see how that would happen if you're using one of the Windows >>> environments wherein malloc's done inside libpq have to be free'd inside >>> libpq. (The PQExpBuffer support code is in libpq...) >> Late reply, but I don't see any way we could fix this easily. > To me it seems like mostly a case of chasing down all the places where > this happens. It's not impossible to do; it's just a bunch of work > that nobody's gotten excited about doing yet. We've fixed similar > issues in many other cases, IIUC. Well, the problem with what I suspect you're thinking of is that even after we fixed all the existing trouble spots, it would keep on breaking. Unless we found some mechanical way to warn about unsafe coding; which in itself would be more work than I want to put into this. However, a plan B occurs to me: what about preventing pg_dump from using libpq's copy of PQExpBuffer? IIUC, a copy of the PQExpBuffer code statically linked into pg_dump would be free of this problem. There's not so much code there that this would be an intolerable price to pay. (Besides, we could probably arrange for the extra copy to happen only on Windows.) regards, tom lane