Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1emfkN-0004C6-62 for pgsql-general@arkaria.postgresql.org; Fri, 16 Feb 2018 13:08:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emfkM-00072D-6Z for pgsql-general@arkaria.postgresql.org; Fri, 16 Feb 2018 13:08:14 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1emfkL-000723-Rx for pgsql-general@lists.postgresql.org; Fri, 16 Feb 2018 13:08:14 +0000 Received: from mailout.toya.net.pl ([217.113.224.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1emfkE-00013E-Fi for pgsql-general@postgresql.org; Fri, 16 Feb 2018 13:08:12 +0000 Received: from mail.toya.net.pl (unknown [10.9.9.167]) by mail.toya.net.pl (Postfix) with ESMTP id B518D182EF1 for ; Fri, 16 Feb 2018 14:08:04 +0100 (CET) Received: by mail.toya.net.pl (Postfix, from userid 114) id A9015182EF2; Fri, 16 Feb 2018 14:08:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on newLazir-deb8.toya.net.pl X-Spam-Level: X-Spam-Status: No, score=-203.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, USER_IN_WHITELIST autolearn=ham autolearn_force=no version=3.4.0 Received: from marlap (unknown [172.17.16.148]) (Authenticated sender: marius@mtvk.pl) by mail.toya.net.pl (Postfix) with ESMTPA id 4418A182ECD; Fri, 16 Feb 2018 14:08:04 +0100 (CET) Message-ID: <1518786484.10667.95.camel@mtvk.pl> Subject: Re: strange construct with RETURN within plpgsql From: mariusz To: "David G. Johnston" Cc: pgsql-general Date: Fri, 16 Feb 2018 14:08:04 +0100 In-Reply-To: References: <1518784266.10667.82.camel@mtvk.pl> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-TOYA-AV-Checked: YES List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, 2018-02-16 at 05:40 -0700, David G. Johnston wrote: > On Fri, Feb 16, 2018 at 5:31 AM, mariusz wrote: > > so, if there is a reason for such a construct and it does > something i > didn't notice, please let me know what is the purpose of > keyword RETURN > after a valid statement. > > > ​ > https://www.postgresql.org/docs/10/static/plpgsql-control-structures.html#PLPGSQL-STATEMENTS-RETURNING > yes, i know what RETURN does and when it does not exit from function (like RETURN NEXT or RETURN QUERY), i know that part of docs, even read that again and again before sending, but i must be blind, because i cannot see any mention of RETURN; where that RETURN keyword does nothing (note the lack of ; before return) maybe knowing all that i just pass the docs too fast, but i honestly cannot see why is this allowed. the only similar thing which comes to my mind is a statement with RETURNING ... clause within cte, but it's not the case here (nor the same spelling) regards, mj