From: | Ryo Kanbayashi <kanbayashi(dot)dev(at)gmail(dot)com> |
---|---|
To: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
Cc: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: ecpg command does not warn COPY ... FROM STDIN; |
Date: | 2025-01-08 14:04:18 |
Message-ID: | CANOn0EwOgYcB-NmanjsGSeo7WE4tNCO=sp2C7wT97KhMucUqUg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Kuroda-san, thank to your comment.
> > I found a code validation bug in master branch.
> >
> > Now, ecpg does not support 'EXEC SQL COPY ... FROM STDIN ... ;' and
> > code for warning it exits.
> >
> > https://github.com/postgres/postgres/blob/7b27f5fd36cb3270e8ac25aefd73b55
> > 2663d1392/src/interfaces/ecpg/preproc/ecpg.addons#L242-L245
> > ---
> > ECPG: addon CopyStmt COPY opt_binary qualified_name opt_column_list
> > copy_from opt_program copy_file_name copy_delimiter opt_with
> > copy_options where_clause
> > if (strcmp(@6, "from") == 0 &&
> > (strcmp(@7, "stdin") == 0 || strcmp(@7, "stdout") == 0))
> > mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN is not
> > implemented");
> > ---
> >
> > But it is not working.
> > ecpg command fails to notice though code like above exits on pgc code.
>
> Good catch. I have a comment about the fix.
>
> The parser accepts a statement like "COPY ... FROM STDOUT", and ISTM it is not either
> implemented yet. However, the warning message only mentions STDIN case even STDOUT
> is specified.
>
> EXEC SQL COPY foo FROM STDOUT;
> ->
> WARNING: COPY FROM STDIN is not implemented
>
> I feel we can change like "COPY FROM STDIN/STDOUT...", or prepare two messages.
> Thought?
I think your proposed fix is better too.
So, I modified the patch.
With new patch, warning message is changed like below :)
ryo(at)DESKTOP-IOASPN6:~/work/postgres/src$ ../master/bin/ecpg
copy_from_should_be_warned.pgc
copy_from_should_be_warned.pgc:24: WARNING: COPY FROM STDIN/STDOUT is
not implemented
ryo(at)DESKTOP-IOASPN6:~/work/postgres/src$
--
Best regards,
Ryo Kanbayashi
https://github.com/ryogrid
On Wed, Jan 8, 2025 at 10:35 PM Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear Kanbayashi-san,
>
> > I found a code validation bug in master branch.
> >
> > Now, ecpg does not support 'EXEC SQL COPY ... FROM STDIN ... ;' and
> > code for warning it exits.
> >
> > https://github.com/postgres/postgres/blob/7b27f5fd36cb3270e8ac25aefd73b55
> > 2663d1392/src/interfaces/ecpg/preproc/ecpg.addons#L242-L245
> > ---
> > ECPG: addon CopyStmt COPY opt_binary qualified_name opt_column_list
> > copy_from opt_program copy_file_name copy_delimiter opt_with
> > copy_options where_clause
> > if (strcmp(@6, "from") == 0 &&
> > (strcmp(@7, "stdin") == 0 || strcmp(@7, "stdout") == 0))
> > mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN is not
> > implemented");
> > ---
> >
> > But it is not working.
> > ecpg command fails to notice though code like above exits on pgc code.
>
> Good catch. I have a comment about the fix.
>
> The parser accepts a statement like "COPY ... FROM STDOUT", and ISTM it is not either
> implemented yet. However, the warning message only mentions STDIN case even STDOUT
> is specified.
>
> EXEC SQL COPY foo FROM STDOUT;
> ->
> WARNING: COPY FROM STDIN is not implemented
>
> I feel we can change like "COPY FROM STDIN/STDOUT...", or prepare two messages.
> Thought?
>
> Best regards,
> Hayato Kuroda
> FUJITSU LIMITED
>
Attachment | Content-Type | Size |
---|---|---|
copy_from_stdin_no_warning2.patch | application/octet-stream | 1023 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Jakub Wartak | 2025-01-08 14:04:39 | Re: AIO v2.0 |
Previous Message | Diego Fronza | 2025-01-08 13:52:30 | Logical replication - proposal for a custom conflict resolution function |