From: | Sutou Kouhei <kou(at)clear-code(dot)com> |
---|---|
To: | sawada(dot)mshk(at)gmail(dot)com |
Cc: | v(dot)popolitov(at)postgrespro(dot)ru, 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-06 12:06:31 |
Message-ID: | 20250206.210631.299317468845267581.kou@clear-code.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
In <CAD21AoDCd9pKZ2XMOUmnmteC60NYBLr80FWY56Nn3NEbxVxdeQ(at)mail(dot)gmail(dot)com>
"Re: Make COPY format extendable: Extract COPY TO format implementations" on Wed, 5 Feb 2025 12:29:44 -0800,
Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
>> It seems that
>> FmgrInfo doesn't have return value type information. Should
>> we read pg_catalog.pg_proc or something for it?
>
> Yes, we can do like what we do for TABLESAMPLE for example:
>
> /* check that handler has correct return type */
> if (get_func_rettype(handlerOid) != TSM_HANDLEROID)
> ereport(ERROR,
> (errcode(ERRCODE_WRONG_OBJECT_TYPE),
> errmsg("function %s must return type %s",
> NameListToString(rts->method), "tsm_handler"),
> parser_errposition(pstate, rts->location)));
Thanks! I didn't know get_func_rettype().
I attach the v32 patch set. 0003 is only changed. The
following check is added. It's similar to TABLESAMPLE's one.
/* check that handler has correct return type */
if (get_func_rettype(handlerOid) != COPY_HANDLEROID)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("function %s must return type %s",
format, "copy_handler"),
parser_errposition(pstate, defel->location)));
Thanks,
--
kou
Attachment | Content-Type | Size |
---|---|---|
v32-0001-Refactor-COPY-TO-to-use-format-callback-function.patch | text/x-patch | 17.8 KB |
v32-0002-Refactor-COPY-FROM-to-use-format-callback-functi.patch | text/x-patch | 32.6 KB |
v32-0003-Add-support-for-adding-custom-COPY-TO-format.patch | text/x-patch | 19.5 KB |
v32-0004-Export-CopyToStateData-as-private-data.patch | text/x-patch | 9.7 KB |
v32-0005-Add-support-for-implementing-custom-COPY-TO-form.patch | text/x-patch | 2.4 KB |
v32-0006-Add-support-for-adding-custom-COPY-FROM-format.patch | text/x-patch | 9.2 KB |
v32-0007-Use-COPY_SOURCE_-prefix-for-CopySource-enum-valu.patch | text/x-patch | 3.5 KB |
v32-0008-Add-support-for-implementing-custom-COPY-FROM-fo.patch | text/x-patch | 2.4 KB |
v32-0009-Add-CopyFromSkipErrorRow-for-custom-COPY-format-.patch | text/x-patch | 11.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Zhang Mingli | 2025-02-06 12:13:47 | Re: Proposal to CREATE FOREIGN TABLE LIKE |
Previous Message | Dagfinn Ilmari Mannsåker | 2025-02-06 11:49:00 | Re: Remove useless casts to (char *) |