RE: ecpg command does not warn COPY ... FROM STDIN;
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Ryo Kanbayashi' <kanbayashi.dev@gmail.com>
Cc: "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2025-01-08T13:35:51Z
Lists: pgsql-hackers
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
Commits
-
ecpg: Restore detection of unsupported COPY FROM STDIN.
- 226c9048d734 13.19 landed
- d06ab3c0c117 14.16 landed
- 71ef47cf0f20 15.11 landed
- 5c7c34db2511 16.7 landed
- ba2dbedd5396 17.3 landed
- 94b914f601bd 18.0 landed
-
plpgsql: pure parser and reentrant scanner
- 7b27f5fd36cb 18.0 cited
-
Add support for piping COPY to/from an external program.
- 3d009e45bde2 9.3.0 cited