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 1s7eGQ-006dwj-7I for pgsql-bugs@arkaria.postgresql.org; Thu, 16 May 2024 16:47:31 +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 1s7eGP-00BxHD-EU for pgsql-bugs@arkaria.postgresql.org; Thu, 16 May 2024 16:47:29 +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 1s7eGP-00BxH4-4K for pgsql-bugs@lists.postgresql.org; Thu, 16 May 2024 16:47:29 +0000 Received: from wfhigh7-smtp.messagingengine.com ([64.147.123.158]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s7eGM-000Wbf-79 for pgsql-bugs@lists.postgresql.org; Thu, 16 May 2024 16:47:27 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfhigh.west.internal (Postfix) with ESMTP id F282E180014B; Thu, 16 May 2024 12:47:23 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 16 May 2024 12:47:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1715878043; x= 1715964443; bh=NJ80KdGnW6GJ6gTavF365kNOUrhYTiD75NZj2CQB6qM=; b=Q 5btRAlgPsD5A30znmijq5l4TKig3UoVoMXBluvutEbOSee+Ycb3k4JD6lZL2QQsW 7vSPcVi0GODOjKRvv5y0zZcV76t+iDttKmhpZK4niQQ48dPyyBzxcQzywh9mUK+Z Jy63b2ydJdvgihqUoc23aLc4B5kSOrLOhDk1jLsTfQC8JBbjI5qLH5FRiZZ/jMy0 KK+/vIgEXvacolJ4CTpvg3bZEIvK+RNyVCFMcyPGrSKFNuoymzWF04Hg2Ly3ku+3 8J2cVnWg2mgmoO5tKWHfBTJXchAS/XlgGCydinohdQ7v5KbxyEmiAu62XxYsVQz7 eq+2PhyvQD0/gSOUUiWxg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdehuddguddtvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhv rghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorh hgqeenucggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeej keffgfdufffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtoh hmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghl vhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 16 May 2024 12:47:23 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1715878041; bh=kqOKm92o27AOphO60AjP7rbXo5ck4pl0mkQgbF3q55o=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=MDDCE+CzPtmNmNVnPYlOx4mC3BXWFIlg8x+er/pZKvDPhN+BIvuT+3yK4cSUetgX3 Xv4OX9slzjDwPngh22HGDzPIhpeI3cO8JzcTljEy+Vk+bdo44/B4IdZIfmPwPM3nLX 5Y2BG0QdFj1IAxP4kj6qfz9WWdnfsPV4MqNpArD/g8zGlTUCfeqGhDdhauW3PZ9p2Z banFBbrxpXzY2UU1nFnmeS1ACxxF/VqLqNsBAjEU45ns07Ijk4X2Kbp8eUeatq0HrD zwD0zSnShhWCXQrojKfZJoBzxM3D+P/q1sv0LxCXjCvoKNq4L3lSAo7B0oKwDC6J77 CNB2nvKYBW+HA== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 394AB95; Thu, 16 May 2024 18:47:21 +0200 (CEST) Date: Thu, 16 May 2024 18:47:21 +0200 From: Alvaro Herrera To: Japin Li Cc: Etsuro Fujita , onderkalaci@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18467: postgres_fdw (deparser) ignores LimitOption Message-ID: <202405161647.dj7lw4asvfpu@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2024-May-17, Japin Li wrote: > After some dig in, I find transformLimitClause() has the following comments: > > * Note: as of Postgres 8.2, LIMIT expressions are expected to yield int8, > * rather than int4 as before. > > So the deparseConst() append '::bigint' typecast, same as get_rule_expr(). Hmm, probably the answer is not to use deparseExpr in appendLimitClause() then. I mean, AFAICS this is a postgres_fdw problem, not a core parser problem. Not sure if this is workable, but maybe test if the value is a constant, and use FETCH FIRST if so, otherwise fall back to using LIMIT. (It's not clear if this would handle FETCH FIRST +123123123123 ROWS WITH TIES correctly though -- worth checking). Oh, I see we never got back to adding FETCH FIRST / PERCENT. We had a patch seemingly almost ready for that ... -- Álvaro Herrera 48°01'N 7°57'E — https://www.EnterpriseDB.com/