Re: Make COPY format extendable: Extract COPY TO format implementations

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Vladlen Popolitov <v(dot)popolitov(at)postgrespro(dot)ru>, Sutou Kouhei <kou(at)clear-code(dot)com>, zhjwpku(at)gmail(dot)com, michael(at)paquier(dot)xyz, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Make COPY format extendable: Extract COPY TO format implementations
Date: 2025-02-05 19:26:20
Message-ID: 202502051926.sqnaa24c4vp7@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sami Imseih 2025-02-05 19:26:56 Re: Prevent COPY FREEZE on Foreign tables
Previous Message Nathan Bossart 2025-02-05 19:24:39 Re: Prevent COPY FREEZE on Foreign tables