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 1jLcQn-0003pS-4C for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2020 00:49:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jLcQm-0001BS-13 for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Apr 2020 00:49:32 +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 1jLcQl-0001BK-QP for pgsql-hackers@lists.postgresql.org; Tue, 07 Apr 2020 00:49:31 +0000 Received: from mail-qv1-xf41.google.com ([2607:f8b0:4864:20::f41]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jLcQj-0005DK-Fs for pgsql-hackers@postgresql.org; Tue, 07 Apr 2020 00:49:30 +0000 Received: by mail-qv1-xf41.google.com with SMTP id c28so1039337qvb.10 for ; Mon, 06 Apr 2020 17:49:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=hs/XifsJhFJdv29ApQ4VG81RWpV1YqE7xEu7ODj7xe4=; b=WEHGua6TPK4n8clhhgsASUV7lKdmC56rwBMMwG3XGf3K495qwPw3MShfdBW+rLYQen zo6olfM0IZAqU1gG2uMn17vq6TY1rM1hoiNNsoxsDlsIhRmnaPzRM5Gl+dF3uWAlXMLZ 0VAygNubo6to13pZULlyqm14gMduRroIV9wBKtBZxYqhINHDXwpAksr7CscySUUyuS3A 4DgOQyKPcL+a0JRUgUAMWuvqQ4Bjvzt5rMU+4lhqtem83FySb4pZTaHov0WXBlarJK4q edZgT5tj2PRafFEHL7l3KjCrNHae+JAGY2pLykX3etq+2RjWeE2ZVPF6xO3WhmY2qc3d X38A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=hs/XifsJhFJdv29ApQ4VG81RWpV1YqE7xEu7ODj7xe4=; b=SE2rFRcoAoaglhFKLculP/4jLLdpSmfMOCBT2yyAtH0cJBuSCGcJ5rIKj1jzOTN7zE ChPX7Gplpvxf4BomYF2AJnYvXbPkeNaJF2B+PLDHMPRioXl0A+ORfUMYlZsu8v+YayxC MTBkmfFYRrTQ4MUs8MmnCqTTgtikuZjQ1p7cWYuNFRSHN5cpUeJOMBU6envUC0sJuLA5 srXXxzrsKzZir8vjcYhp3+qP5m6jKLFkDc9aTHTRcpZ/KjM0qddIM2SKmVMRYhdWuEuT MBcu/qSsn3efvWoOkxdEr7/d8a0D7gpXpQ8UIJu8fya7YBL8TP3j622vEbB/XIpHfs+V 9qpw== X-Gm-Message-State: AGi0PuYiPSPkpecPmaT1xGwoabHvxM180hvywpibCWYThZRS8NPpdw0d BCySzHRu4IV0wqqV5DRN+RnKzQ== X-Google-Smtp-Source: APiQypKTx1c/b1JwtBqF5ZrFpCpr1q/bm9k3bFjBbM/qhlDxypdsIemN3FESuexqhBBHk214TACXBQ== X-Received: by 2002:a05:6214:906:: with SMTP id dj6mr2543747qvb.36.1586220568602; Mon, 06 Apr 2020 17:49:28 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id f71sm15897252qke.57.2020.04.06.17.49.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Apr 2020 17:49:28 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id F0F6A300A04; Mon, 6 Apr 2020 20:49:25 -0400 (-04) Date: Mon, 6 Apr 2020 20:49:25 -0400 From: Alvaro Herrera To: Surafel Temesgen Cc: Tomas Vondra , PostgreSQL Hackers , Andrew Gierth Subject: Re: FETCH FIRST clause WITH TIES option Message-ID: <20200407004925.GA23627@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200407003502.GA20914@alvherre.pgsql> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Some ruleutils.c code added by this patch is not covered by tests: 5246 : /* Add the LIMIT clause if given */ 5247 1115 : if (query->limitOffset != NULL) 5248 : { 5249 0 : appendContextKeyword(context, " OFFSET ", 5250 : -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); 5251 0 : get_rule_expr(query->limitOffset, context, false); 5252 : } 5253 1115 : if (query->limitOption == LIMIT_OPTION_WITH_TIES) 5254 : { 5255 0 : appendContextKeyword(context, " FETCH FIRST ", 5256 : -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); 5257 0 : get_rule_expr(query->limitCount, context, false); 5258 0 : appendContextKeyword(context, " ROWS WITH TIES ", 5259 : -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); 5260 : } 5261 1115 : if (query->limitCount != NULL && query->limitOption != LIMIT_OPTION_WITH_TIES) 5262 : { 5263 2 : appendContextKeyword(context, " LIMIT ", 5264 : -PRETTYINDENT_STD, PRETTYINDENT_STD, 0); 5265 2 : if (IsA(query->limitCount, Const) && 5266 0 : ((Const *) query->limitCount)->constisnull) 5267 0 : appendStringInfoString(buf, "ALL"); 5268 : else 5269 2 : get_rule_expr(query->limitCount, context, false); 5270 : } Other than that, the patch seems good to go to me, so unless there are objections, I intend to get this pushed tomorrow. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services