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 1rUjd0-00CjtT-Ok for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jan 2024 08:37:59 +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 1rUjcz-003pDh-0K for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Jan 2024 08:37:57 +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 1rUjcy-003pDZ-Mx for pgsql-hackers@lists.postgresql.org; Tue, 30 Jan 2024 08:37:56 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rUjcw-0047Gg-3h for pgsql-hackers@postgresql.org; Tue, 30 Jan 2024 08:37:55 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 044BD3200B6A; Tue, 30 Jan 2024 03:37:50 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 30 Jan 2024 03:37:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1706603870; x=1706690270; bh=ZmOH1Ysc31 jm85n24U/8z3wrZLwf5SthD4iDi8mjzRI=; b=tted6sxYBnwNMnh/g6uZagq0oY k9G4+d3eoa4XNsfaXN0uD8wSA/EuFeR1UqkCzMXP4ncBDTelxUMCjCdItlO1Ml2I p+3JJCCoPfvaqb+OB89d5ONs/pq4joki14GPEH7de2/aa2Qy5HVxdn5KHy8hV0ec bq8oGeEKFN8/hIj5Xbrl2y/j2xw0xQ08Mc2o1ZSD6AdHCljbT/MVRZMoPoTce9Dt qz7KdnXiA7JaCpn+zDl7Z3252du9KbikseBfxm2CcOPEMD8n3AI9RxyusT9LORfb URoGsVhrRlKOy2QaE5+SS3pqOeo8QU1UCHJp3Zfmr+dF3WrCGRHk+fi7KU7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1706603870; x=1706690270; bh=ZmOH1Ysc31jm85n24U/8z3wrZLwf 5SthD4iDi8mjzRI=; b=nkUgPKycttFR3FdqpHmY/OHdb4erXau5eMwmC78WYi7+ IlsrKU+DKm6jr8MixPrWuhV7vC6tJIN0pqgIdkA2exMLavN5ab8TdpAVSJB87RP+ 1ByMOn/E6VLBAJ0ZY8z1JgOhPVEQJaZh2Vbg5Pcw3QpN/CjpHfHBpEOMyPpQJxfH OjaVqTZspn5gbychl6RNMi19z171aZSrdRi1fjXpEoO6MyVYI/yay2a6BDc+0pif OxhEvIGTZpqLtl8KvMGd/7n0t9BloWNpP3YcUZj2fWS1mVESkCZ6lDepGBQfuKRq hBMAvj24LYiyE0yIR5swHIkbF8y0VDiBHWWyUSkBXA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedthedguddvtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecufghrlhcuvffnffculdejtddmnecujfgurhepff fhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgr qhhuihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtth gvrhhnpeetleeifedufffhhfdtteelgeeggeffhfekueevteeigfduudevudetgfegiedv jeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmih gthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 30 Jan 2024 03:37:46 -0500 (EST) Date: Tue, 30 Jan 2024 17:37:35 +0900 From: Michael Paquier To: Sutou Kouhei Cc: sawada.mshk@gmail.com, zhjwpku@gmail.com, andrew@dunslane.net, nathandbossart@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Make COPY format extendable: Extract COPY TO format implementations Message-ID: References: <20240130.144531.1257430878438173740.kou@clear-code.com> <20240130.171511.2014195814665030502.kou@clear-code.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="HtyyS77X0bduSMm8" Content-Disposition: inline In-Reply-To: <20240130.171511.2014195814665030502.kou@clear-code.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --HtyyS77X0bduSMm8 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 30, 2024 at 05:15:11PM +0900, Sutou Kouhei wrote: > We use defel->location for an error message. (We don't need > to set location for the default "text" DefElem.) Yeah, but you should not need to have this error in the paths that set the callback routines in opts_out if the same validation happens a few lines before, in copy.c. > Yes, sure. > (We want to focus on the performance gains in the first > patch set and then focus on extensibility again, right?) Yep, exactly, the numbers are too good to just ignore. I don't want to hijack the thread, but I am really worried about the complexities this thread is getting into because we are trying to shape the callbacks in the most generic way possible based on *two* use cases. This is going to be a never-ending discussion. I'd rather get some simple basics, and then we can discuss if tweaking the callbacks is really necessary or not. Even after introducing the pg_proc lookups to get custom callbacks. > For the purpose, I think that the v7 patch set is more > suitable than the v9 patch set. The v7 patch set doesn't > include Init() callbacks, custom options validation support > or extra Copy{In,Out}Response support. But the v7 patch set > misses the removal of the "if" checks in > NextCopyFromRawFields() that exists in the v9 patch set. I'm > not sure how much performance will improve by this but it > may be worth a try. Yeah.. The custom options don't seem like an absolute strong requirement for the first shot with the callbacks or even the possibility to retrieve the callbacks from a function call. I mean, you could provide some control with SET commands and a few GUCs, at least, even if that would be strange. Manipulations with a list of DefElems is the intuitive way to have custom options at query level, but we also have to guess the set of callbacks from this list of DefElems coming from the query. You see my point, I am not sure=20 if it would be the best thing to process twice the options, especially when it comes to decide if a DefElem should be valid or not depending on the callbacks used. Or we could use a kind of "special" DefElem where we could store a set of key:value fed to a callback :) > Can I prepare the v10 patch set as "the v7 patch set" + "the > removal of the "if" checks in NextCopyFromRawFields()"? > (+ reverting opts_out->{csv_mode,binary} changes in > ProcessCopyOptions().) Yep, if I got it that would make sense to me. If you can do that, that would help quite a bit. :) -- Michael --HtyyS77X0bduSMm8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmW4tU8ACgkQnvQgOdby QH0olQ/+OcL7PH4rHaO2TiMNDq5UMJ1mBjN3FeuOguteocJ1JHLTvHp1Wl62lhQ4 4kTCc+NBvJEn048w3X81d/fl76gvOXVOTxG3wsLGm+z4pOz3I/ahsjFsAXhBidUh DZI4/5bxGkouiJt5FmwYWHiAzscJ8DYW2dwtVMiLBdXzsQBNRPinEj1lt+tjtLML kjg3uDb1wCDlliez+eXRXsI4DcdY339CAkEAA6h3EAKdjVwAB3k8GnOF6l5OP4eZ FOyOokNQVz7dtACvW1mXyfCbS9UtbB8ZFD+0D8SXQFDhQTEdVH7iZnakYGWcZigd HUs3eEvMFty8e6E7+0iR0/Nl26QeTQ90lbQ5qmkoTLimrLPSYbt13tD2qz0opOXF i/9gPqBPNBzNi4XDw1MScvoKntlCd7htDjRTCMkcHWANZiqNXp0OsZIzJFy1iCrS maZ44RzF4b1qrH2eD6L8WSoTeRfNaFOBmcnCDQ9YTMI5Lj7JqwUaEFBw0nTGqVTN MDy80T95qADGR85nhK1Foel4A6RcwLSjETXCtNLfndcgFIdHWQ9glNvoz8d1r14m LJ9kmRwGhJ2EyulH0oDsE6gzimVj69IBwdRwbMT/Dgy9SiEzK0E1dD6VWKwgyQBk xyFtUZxRQEbLKZZ1UXT3IXjangrtWslIWvXPG86HH61vkO6rXGo= =Sc/7 -----END PGP SIGNATURE----- --HtyyS77X0bduSMm8--