Re: COPY table FROM STDIN doesn't show count tag
От | Amit Khandekar |
---|---|
Тема | Re: COPY table FROM STDIN doesn't show count tag |
Дата | |
Msg-id | CACoZds3g-o4ZFgUEdugWYRtsX79EvsCQscr9j8-Vp=ANgEdiWQ@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: COPY table FROM STDIN doesn't show count tag (Rajeev rastogi <rajeev.rastogi@huawei.com>) |
Список | pgsql-hackers |
OK. I have revised the patch as per the discussion.
Now if \copy command is called then, we are setting the appropriate value of _psqlSettings->copystream in do_copy and same is being used inside handleCopyIn() and handleCopyOut(). Once the \copy command execution finishes, we are resetting the value of _psqlSettings->copystream to NULL. And if COPY(No slash) command is used, then in that case _psqlSettings->copystream will be NULL. So based on this value being NULL, copyStream will be assigned as stdout/stdin depending on TO/FROM respectively inside the function handleCopyOut()/handleCopyIn().
Also in order to address the queries like
./psql -d postgres -c "\copy tbl to '/home/rajeev/9.4gitcode/install/bin/data/temp.txt'; copy tbl from stdin;"
Inside the function ProcessResult, we check that if it is the second cycle and result status is COPY OUT or IN, then we reset the value of _psqlSettings->copystream to NULL, so that it can take the value as stdout/stdin for further processing.
handleCopyOut(PGconn *conn, FILE *copystream, PGresult **res)
Please provide your opinion.
Thanks and Regards,
Kumar Rajeev Rastogi
В списке pgsql-hackers по дате отправления: