Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwmI8-0001iU-DT for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Dec 2021 14:27:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mwmI7-0002Tp-7M for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Dec 2021 14:26:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mwmI6-0002R5-IM for pgsql-hackers@lists.postgresql.org; Mon, 13 Dec 2021 14:26:58 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mwmI1-0007sT-FD for pgsql-hackers@lists.postgresql.org; Mon, 13 Dec 2021 14:26:57 +0000 Received: by mail-ed1-x52d.google.com with SMTP id r25so52212081edq.7 for ; Mon, 13 Dec 2021 06:26:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=XsW6/3UtSUKVQplXa9VRc4zkk9IatK2bdW2QQOyyBnw=; b=OWEuhSXpvBdsvrZ7fKiRWLw1zD+ojJBy5VxKFiYXWpu9h4HOsWMSgNXw+2Av8SOjIg PcL7VOLIY3pf4ZxFAh58fw/Xq5fSv47d7O4K5Ei1U2h9qC9o5Zd1KZJJlj9PPj2kwlx2 Eo0LNdPaqcxZE/ymoCQzGpvLpa8rcphdj5o4wc1A+fgQTjbCCZhQEjOQrvxYcmqtc7eo t94UixM9YREQ/XodYLbdhuTXPhpTQy8Xvs86nHPrHS7f3WYZWFXg68tQeEGOiB6YrkVm FqBSU9XjqckzeUpStD8lHf3kYniz/XxuguK/V9ckFOxFl23agjb/tjpy8Kg1C1vxWiWm gV3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=XsW6/3UtSUKVQplXa9VRc4zkk9IatK2bdW2QQOyyBnw=; b=WQ2qsEACPDHWqIJfYaWiOpgnOKzn+p9QVcxaT8u+h1H+B8l2EDWCjLDZQ0x0D/BQQ4 kusNtTFB49Sa5/i1cAlu6tXYA7D5IHUEOQrJog9FRp6YXWHNlur6rG8aqom/cKzzFBu9 vNEw0ifraAEQ4hVuaQh5GcdieJtGrBOScqe4iKW9TrmHi3N6M1lc2pOXPMXmPPiQajmt eBei59k9/bKTBJzvTCTnE4gkorYU1b30fXdG02jIGpK3Q+hwyOnGj7ymC/YoyXRReOg3 CVXAzinTtS4vYgNot43B7C6eltG9boUHz13b/68tR0VwPHLLmewQftpGlblNqcK44lJD u/XA== X-Gm-Message-State: AOAM530sNl6bFFLQMZZN6HzYAiJX8pV1zh79ttX4DrKCQD0LhQQ05JHm k0Hr+dWwMFHF/Q+lFeXh9Z/pCpQpijp80XrMChaYJD3v1PmWPoCGXWsdHZ9TLmNbybMERaGByRp um30S2FA0WRlFhWY8fyHTmRxAzraNMkeO8SA9CIEeW+oVwDVyDLM78ID2F4PhAiHgthIe3VFZAZ ntN82WmRbB//i1j2U7LpjgQbjEGAXPE9HWxWGIna7GyxR7weXofVIKwrZ29/NS X-Google-Smtp-Source: ABdhPJwOnXRy+K16idzCitQE5Bfh1LWItiiPBlvlyOp6qfLSqLWDJ3H/NRukDqgHbnnd0YXVmzKAhQ== X-Received: by 2002:a50:d606:: with SMTP id x6mr2303335edi.124.1639405608310; Mon, 13 Dec 2021 06:26:48 -0800 (PST) Received: from [10.137.0.18] (ip-86-49-251-241.net.upcbroadband.cz. [86.49.251.241]) by smtp.gmail.com with ESMTPSA id bm22sm6541650edb.48.2021.12.13.06.26.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Dec 2021 06:26:47 -0800 (PST) Message-ID: <0cac2d60-5b85-59c6-1ac1-77092b8688b7@enterprisedb.com> Date: Mon, 13 Dec 2021 15:26:44 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: daitch_mokotoff module Content-Language: en-US To: Dag Lem , PostgreSQL Hackers References: From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/13/21 14:38, Dag Lem wrote: > Please find attached an updated patch, with the following fixes: > > * Replaced remaining malloc/free with palloc/pfree. > * Made "make check" pass. > * Updated notes on other implementations. > Thanks, looks interesting. A couple generic comments, based on a quick code review. 1) Can the extension be marked as trusted, just like fuzzystrmatch? 2) The docs really need an explanation of what the extension is for, not just a link to fuzzystrmatch. Also, a couple examples would be helpful, I guess - similarly to fuzzystrmatch. The last line in the docs is annoyingly long. 3) What's daitch_mokotov_header.pl for? I mean, it generates the header, but when do we need to run it? 4) It seems to require perl-open, which is a module we did not need until now. Not sure how well supported it is, but maybe we can use a more standard module? 5) Do we need to keep DM_MAIN? It seems to be meant for some kind of testing, but our regression tests certainly don't need it (or the palloc mockup). I suggest to get rid of it. 6) I really don't understand some of the comments in daitch_mokotov.sql, like for example: -- testEncodeBasic -- Tests covered above are omitted. Also, comments with names of Java methods seem pretty confusing. It'd be better to actually explain what rules are the tests checking. 7) There are almost no comments in the .c file (ignoring the comment on top). Short functions like initialize_node are probably fine without one, but e.g. update_node would deserve one. 8) Some of the lines are pretty long (e.g. the update_node signature is almost 170 chars). That should be wrapped. Maybe try running pgindent on the code, that'll show which parts need better formatting (so as not to get broken later). 9) I'm sure there's better way to get the number of valid chars than this: for (i = 0, ilen = 0; (c = read_char(&str[i], &ilen)) && (c < 'A' || c > ']'); i += ilen) { } Say, a while loop or something? regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company