Which hook to use when overriding utility commands (COPY ...) - Mailing list pgsql-hackers

From Hannu Krosing
Subject Which hook to use when overriding utility commands (COPY ...)
Date
Msg-id CAMT0RQRPRu9CwKnXM5dA7F5L-UsGkS_pNyH23hyO1xJZE95OKg@mail.gmail.com
Whole thread Raw
Responses Re: Which hook to use when overriding utility commands (COPY ...)
List pgsql-hackers
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

pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: support for MERGE
Next
From: Michael Paquier
Date:
Subject: Re: Which hook to use when overriding utility commands (COPY ...)