Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qey54-008zsq-74 for pgsql-hackers@arkaria.postgresql.org; Sat, 09 Sep 2023 13:32:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qey50-00Gv6E-KD for pgsql-hackers@arkaria.postgresql.org; Sat, 09 Sep 2023 13:32:54 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qey50-00Gv5r-9n for pgsql-hackers@lists.postgresql.org; Sat, 09 Sep 2023 13:32:54 +0000 Received: from relay1-d.mail.gandi.net ([2001:4b98:dc4:8::221]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qey4t-003cB8-PD for pgsql-hackers@postgresql.org; Sat, 09 Sep 2023 13:32:52 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 28F5F240004; Sat, 9 Sep 2023 13:32:41 +0000 (UTC) Message-ID: Date: Sat, 9 Sep 2023 15:32:41 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: Row pattern recognition Content-Language: en-US To: Tatsuo Ishii , jchampion@timescale.com Cc: er@xs4all.nl, pgsql-hackers@postgresql.org References: <20230908.125447.478562939918621603.t-ishii@sranhm.sra.co.jp> <96b4d3c8-1415-04db-5629-d2617ac7a156@timescale.com> <20230909.202121.983745512339833395.t-ishii@sranhm.sra.co.jp> From: Vik Fearing In-Reply-To: <20230909.202121.983745512339833395.t-ishii@sranhm.sra.co.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-GND-Sasl: vik@postgresfriends.org List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/9/23 13:21, Tatsuo Ishii wrote: > Thanks for the explanation. Surprising concet of the standard:-) This leaves the choice between traditional NFA and Posix NFA. The difference between these is that a traditional NFA exits (declares a match) as soon as it finds the first possible match, whereas a Posix NFA is obliged to find all possible matches and then choose the “leftmost longest”. There are examples that show that, even for conventional regular expression matching on text strings and without back references, there are patterns for which a Posix NFA is orders of magnitude slower than a traditional NFA. In addition, reluctant quantifiers cannot be defined in a Posix NFA, because of the leftmost longest rule. Therefore it was decided not to use the Posix NFA model, which leaves the traditional NFA as the model for row pattern matching. Among available tools that use traditional NFA engines, Perl is the most influential; therefore Perl was adopted as the design target for pattern matching rules. > Is it different from SIMILAR TO REs too? Of course it is. :-) SIMILAR TO uses its own language and rules. > What if we don't follow the standard, instead we follow POSIX EREs? I > think this is better for users unless RPR's REs has significant merit > for users. This would get big pushback from me. -- Vik Fearing