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 1h5Mog-0008NI-4D for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Mar 2019 03:50:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h5Mod-0000Pn-Hg for pgsql-hackers@arkaria.postgresql.org; Sun, 17 Mar 2019 03:50:27 +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 1h5Moc-0000Pg-VT for pgsql-hackers@lists.postgresql.org; Sun, 17 Mar 2019 03:50:27 +0000 Received: from anastigmatix.net ([68.171.219.55]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h5MoV-0005ZJ-8A for pgsql-hackers@postgresql.org; Sun, 17 Mar 2019 03:50:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=cC6N0cGf+leFYz71r0jzB+VFmTbphknWmwPu/zeOr7s=; b=gn8XFpVspaHmueTkwxdnz1Pg/r M1xUFSEyOWLCNhspWQls2O7qMNByEFrVK+CvDEhP8CMNAHYlZchBtQdnxU2XsnLsfhjmVP+iglvnL UYMBYGcDJ+qIgV7Mg50yFQElpysok6OOt31lYn1dGRnclB8dNPXqTBZTujIwseeF4AJzMi+lTrqjG hgyQ7sErGKP1l37HbWgOrNsk6MMrGltEFzU78tvOKbQxU2h6HX0cw3IIAqhH4rnU/MFfN2hLq4Rou Gez+q5vzM557iuBhPWwNONBj7gNRF+K97BDC+zuuNUxaH+aobPgfI6ANyrVNGSZYPbTsh/D5kwSpF W9pRGbTQ==; Received: from [184.19.63.78] (port=45847) by bay.acenet.us with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.91) (envelope-from ) id 1h5MoS-003Sim-7Z; Sat, 16 Mar 2019 23:50:17 -0400 Subject: Re: Fix XML handling with DOCTYPE To: Tom Lane 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> Cc: Ryan Lambert , pgsql-hackers@postgresql.org From: Chapman Flack X-Enigmail-Draft-Status: N1110 Message-ID: <5C8DC3F7.9050604@anastigmatix.net> Date: Sat, 16 Mar 2019 23:50:15 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 MIME-Version: 1.0 In-Reply-To: <5C8D79AF.7010204@anastigmatix.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-OutGoing-Spam-Status: No, score=-96.8 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap@anastigmatix.net X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 03/16/19 18:33, Chapman Flack wrote: > The pre-scan is a simple linear search and will ordinarily say yes or no > within a couple dozen characters--you could *have* an input with 20k of > leading whitespace and comments, but it's hardly the norm. Just trying to If the available regexp functions want to start by munging the entire input into a pg_wchar array, then it may be better to implement the pre-scan as open code, the same way parse_xml_decl() is already implemented. Given that parse_xml_decl() already covers the first optional thing that can precede the doctype, the remaining scan routine would only need to recognize comments, PIs, and whitespace. That would be pretty straightforward. Regards, -Chap