Re: Make COPY format extendable: Extract COPY TO format implementations - Mailing list pgsql-hackers

From Álvaro Herrera
Subject Re: Make COPY format extendable: Extract COPY TO format implementations
Date
Msg-id 202502051926.sqnaa24c4vp7@alvherre.pgsql
Whole thread Raw
In response to Re: Make COPY format extendable: Extract COPY TO format implementations  (Masahiko Sawada <sawada.mshk@gmail.com>)
List pgsql-hackers
On 2025-Feb-05, Masahiko Sawada wrote:

> I think that the patch needs to check if the function's result type is
> COPY_HANDLEROID by using get_func_rettype(), before calling it. But
> with this check, we can prevent arbitrary functions from being called
> via COPY. Why do we need to extend CREATE ACCESS METHOD too for that
> purpose?

It's a nicer UI than a bare CREATE FUNCTION, but perhaps it is overkill.
IIRC the reason we require CREATE ACCESS METHOD for table AMs is so that
we acquire a pg_am entry with an OID that can be referenced from
elsewhere, for instance you can't drop an AM if tables are using it; but
you can't use COPY in rules or anything like that that's going to be
stored permanently.  Perhaps you're right that we don't need this for
extensible COPY FORMAT.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Prevent COPY FREEZE on Foreign tables
Next
From: Sami Imseih
Date:
Subject: Re: Prevent COPY FREEZE on Foreign tables