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 1nVXGf-0000KK-5R for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Mar 2022 11:29:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nVXGc-0001sH-Dj for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Mar 2022 11:29:06 +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 1nVXGb-0001s7-U1 for pgsql-hackers@lists.postgresql.org; Sat, 19 Mar 2022 11:29:05 +0000 Received: from mail-ua1-x934.google.com ([2607:f8b0:4864:20::934]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nVXGV-0005Md-2k for pgsql-hackers@postgresql.org; Sat, 19 Mar 2022 11:29:04 +0000 Received: by mail-ua1-x934.google.com with SMTP id j7so4110079uap.5 for ; Sat, 19 Mar 2022 04:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=KoLDD4uZJ7718Mf+c0+blix+uF4m2q4y3vK4/E2aXsE=; b=EJn7CiAslhUxz2heBpiWiQRPdiIXwln6yF7O2MMULNTugcZQlH1AZTiI4hJBYUU7S4 7jW3VVPtmw8ouiMxg3aXHLhGxMGND84yGNGS6iWsV64ZzC0c6vq4pb10ZMkf224D5Pyc 96IOUF9CFYnrgj7bUtA4GZUxj1WcO3/O0Pj1ZDgLCfFivHUF+JthOk0S9P+q7L+hGAjL TaoH8+XBjNQVpC+NSE9s/AKPUunvAhb26VZCZV0MtsSqjS03Z9DUvbnDxea/qbJFzK7/ evUN4AmLA5K641CZXx5a9rJdOQtJbWVGEpaagOATm2cLqEYc/yWwN6tC+SqxcLcjBmYV 3wsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=KoLDD4uZJ7718Mf+c0+blix+uF4m2q4y3vK4/E2aXsE=; b=wfr3L0btRB2zpSXdkLdAVGjp0E+KnE4hAvgyVCkskIVv3GxC4wGMAsMVO64vbYimnI aaGUhv2pDxOFKwgIlcpv8+vHqzhLquaWoorDYGA/Xz5EuicuzP0vWeQC2f+CEihXUJuh /ddSRtk3sZlthdyM1ZT9T0R8hiw861APgAuX44uXLcYo+1ANxsxQXGcObp7OUZoOm85v r0nt3h1kgfN2Btaa4mWt7cZfTV23+/unQ6KVjK8scViA6ep3wH2HE18mYLyeTZwxGkaF ftMvUrFHVTQ/+xunhLGtEHzovhuL7TRmEvAAPPSpw6GBULr6Xg8gQTlLKFDXn4nscdJl I8Lg== X-Gm-Message-State: AOAM533qyhrMW0k3Xu7v62e2MRGlGv92bEyb/PMxiiH2HdUoiZMeCmEf tM1Zb4VzJXuW7tfBDWBlTn2ywRaSAsS4MOhkiUea8HrXzbw= X-Google-Smtp-Source: ABdhPJx4G7pv5QJsOZB+477crSsngtki0ahi2fAJFMwp8y9U1gueShJ08nOydeGzyt+AXBWmRx9IcKq+PybrZVffNFI= X-Received: by 2002:ab0:6989:0:b0:346:b33f:7b94 with SMTP id t9-20020ab06989000000b00346b33f7b94mr4173753uaq.5.1647689336768; Sat, 19 Mar 2022 04:28:56 -0700 (PDT) MIME-Version: 1.0 From: Hannu Krosing Date: Sat, 19 Mar 2022 12:28:46 +0100 Message-ID: Subject: Which hook to use when overriding utility commands (COPY ...) To: pgsql-hackers Content-Type: multipart/alternative; boundary="0000000000009ed8a405da9091dc" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009ed8a405da9091dc Content-Type: text/plain; charset="UTF-8" Hi Pgsql-Hackers Which hook should I use when overriding the COPY command in an extension? I am working on adding new functionalities to COPY (compression, index management, various other transports in addition to stdin and file, other data formats, etc...) and while the aim is to contribute this to v15 I would also like to have much of it in earlier versions. As the current policy is to back-port only bugfixes and not "features" , the only way I can see to get it in earlier versions is to provide an extension which intercepts the COPY command and replaces it with my own implementation. So my question is, which of the hooks would be easiest to use for this ? At the syntax level it would still look the same COPY ... FROM/TO ... WITH ( options) and the extensibility will be in file names (using a URI scheme mapped to transports) and in options part. so I hope to fully reuse the parsing part and get in before the existence checks. Does anyone have experience in this and can [point to samples? Cheers Hannu --0000000000009ed8a405da9091dc Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi=C2=A0Pgsql-Hackers

Which hook should= I use when overriding the COPY command in an extension?

I am workin= g on adding new functionalities to COPY (compression, index management, var= ious other transports in addition to stdin and file, other data formats, et= c...) and while the aim is to contribute this to v15 I would also like to h= ave much of it in earlier versions.

As the current policy is to back= -port only bugfixes and not "features" , the only way I can see t= o get it in earlier versions is to provide an extension which intercepts th= e COPY command and replaces it with my own implementation.

So my que= stion is, which of the hooks would be easiest to use for this ?

At t= he syntax level it would still look the same COPY ... FROM/TO ... WITH ( op= tions) and the extensibility will be in file names (using a URI scheme mapp= ed to transports) and in options part.
so I hope to fully reuse the pars= ing part and get in before the existence checks.

Does anyone have ex= perience in this and can [point to samples?

Cheers
Hannu
--0000000000009ed8a405da9091dc--