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 1lW1nT-0002ZZ-H3 for pgsql-committers@arkaria.postgresql.org; Mon, 12 Apr 2021 19:00:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lW1nR-0008UH-TU for pgsql-committers@arkaria.postgresql.org; Mon, 12 Apr 2021 19:00:29 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lW1nR-0008UA-KB for pgsql-committers@lists.postgresql.org; Mon, 12 Apr 2021 19:00:29 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lW1nO-0004kc-11 for pgsql-committers@lists.postgresql.org; Mon, 12 Apr 2021 19:00:28 +0000 Received: by mail-ed1-x536.google.com with SMTP id w18so16422675edc.0 for ; Mon, 12 Apr 2021 12:00:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=9LWQD7vLyLR2IsSAViYCGnFVpF+FpkyzdBAnHleQTss=; b=HISW/xkj0q1fqmnGaDjuVvgU/e+ZqArVusnrRfXN6dqMW1RL+nKGpiSBX7+zZRyj0G pnT7N9MmVaJj8u2xZSv9ffOMixJCTR3wbvVgK8yFx68yuqx14H0+YV+HkUbk5IwzAfd+ dRvKPfPu76UVBl8x9z8F83HO3iX3M/r7HoNfJe0lxIgX9ydxKC4655kjMCneELDa47FV movJV7/ZWq7JrEY854imUHLAoBXKiPbjIW5js1yFbT9cihGb+xMzc2GiddtEQpluGER2 M1J2oWoF2h7FKEnW3Pi23C0f0O1XN0ofPRyxZr4uwaasuZ9MyAq5ZfM5246MQN4WylSV SDBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=9LWQD7vLyLR2IsSAViYCGnFVpF+FpkyzdBAnHleQTss=; b=mfdoIGSLdcoeISpZZ12E8wyj4jBo3XK95lmhrjUIholwsRvsl+dN0r5l3VUj18GBQi sIUvoPprn2zmHYodb1ojjb12sbMpMzrOaN4bWbzQcKf9kwi2UwTkkia1ZFo3zH/w8/Ez mdZQ8T2yrucUQG/4GFgSwbVwfDyfp+yXqRhbvJWxLa9EG1r9Xzal9GbrCSC+vmH2l30N 408uq7uNKOTRtoGC75LCVISckPZPdpm/VKrkuB49xacagO3hKldM08p+/4p5+curUK7Z 5/i2WB8TvF99W5WIlPWUU7SgfrEeJjxFcyd/cV+6TGafLeWwwQ3XIyA+DKtZ2TEDOQns uxCw== X-Gm-Message-State: AOAM530r5cJrPWjuCsONfjcCAAQ9wDjk7GjzOxQNjU4a4/8OkmfwE+K6 6+C/ZLB4ekmy/wnt+9BmxJEEag== X-Google-Smtp-Source: ABdhPJx6+efETD/2SdhnP9UJQI3I4TWECcwCoo47DOjsCq+vcaJkGplL2BxvKla+qz/7c03k1CMTQA== X-Received: by 2002:aa7:c2cc:: with SMTP id m12mr16011420edp.259.1618254024151; Mon, 12 Apr 2021 12:00:24 -0700 (PDT) Received: from localhost.localdomain (178-190-169-122.adsl.highway.telekom.at. [178.190.169.122]) by smtp.gmail.com with ESMTPSA id ay3sm7542253edb.2.2021.04.12.12.00.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Apr 2021 12:00:23 -0700 (PDT) Message-ID: Subject: Re: pgsql: SQL-standard function body From: Laurenz Albe To: Peter Eisentraut , pgsql-committers@lists.postgresql.org Date: Mon, 12 Apr 2021 21:00:20 +0200 In-Reply-To: <823c7393-a2ca-c44a-c57a-b5ff84c3de28@enterprisedb.com> References: <7466db64eb6abae93e583faf8ca4004d60c163c4.camel@cybertec.at> <823c7393-a2ca-c44a-c57a-b5ff84c3de28@enterprisedb.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2021-04-12 at 17:25 +0200, Peter Eisentraut wrote: > On 10.04.21 03:38, Laurenz Albe wrote: > > On Fri, 2021-04-09 at 19:44 +0200, I wrote: > > > > SQL-standard function body > > > > > > > > psql needs some new intelligence to keep track of function body > > > > boundaries so that it doesn't send off statements when it sees > > > > semicolons that are inside a function body. > > > > > > This causes psql to fail to recognize the semicolon in the following > > > statement as the end of a statement: > > > > > > IMPORT FOREIGN SCHEMA x FROM SERVER y INTO z OPTIONS (case 'lower'); > > > > > > The cause is the "case", which is recognized as the start of a function > > > body. > > > > > > Would it be an option to recognize BEGIN and CASE as starting a > > > function body only if they are *not* inside parentheses, like in > > > the attached? > > > > Here is an improved patch, which treats END in the same fashion > > (not properly indented for readability). > > Thanks, I took another look at this and augmented your change with a > change that tracks whether the statement starts with CREATE [OR REPLACE] > {FUNCTION|PROCEDURE}. That should make it pretty safe. What do you think? Thanks, that is fine with me and more than I asked for. That should definitely exclude all false positive matches. Yours, Laurenz Albe