Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5ZPS-0002QC-2l for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Mar 2019 17:17:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h5ZPQ-00082T-MK for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Mar 2019 17:17:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5ZPQ-00082M-FB for pgsql-hackers@lists.postgresql.org; Sun, 17 Mar 2019 17:17:16 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5ZPO-0001do-K2 for pgsql-hackers@postgresql.org; Sun, 17 Mar 2019 17:17:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x2HHGVSN031665; Sun, 17 Mar 2019 13:16:31 -0400 From: Tom Lane To: Chapman Flack cc: Ryan Lambert , pgsql-hackers@postgresql.org Subject: Re: Fix XML handling with DOCTYPE In-reply-to: <5C8E7FC0.8040401@anastigmatix.net> References: <5C8D5D16.7090206@anastigmatix.net> <23319.1552769738@sss.pgh.pa.us> <5C8D6681.4070504@anastigmatix.net> <24203.1552771272@sss.pgh.pa.us> <5C8D79AF.7010204@anastigmatix.net> <5146.1552837534@sss.pgh.pa.us> <5C8E7FC0.8040401@anastigmatix.net> Comments: In-reply-to Chapman Flack message dated "Sun, 17 Mar 2019 13:11:28 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <31663.1552842991.1@sss.pgh.pa.us> Date: Sun, 17 Mar 2019 13:16:31 -0400 Message-ID: <31664.1552842991@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Chapman Flack writes: > What I was doing in the patch is the reverse: parsing with the expectation > of CONTENT to see if a DTD gets tripped over. It isn't allowed for an > element to precede a DTD, so that approach can be expected to fail fast > if the other branch needs to be taken. Ah, right. I don't have any problem with trying the CONTENT approach before the DOCUMENT approach rather than vice-versa. What I was concerned about was adding a lot of assumptions about exactly how libxml would report the failure. IMO a maximally-safe patch would just rearrange things we're already doing without adding new things. > But a quick pre-scan for the same thing would have the same property, > without the libxml dependencies that bother you here. Watch this space. Do we need a pre-scan at all? regards, tom lane