Re: COPY table FROM STDIN doesn't show count tag - Mailing list pgsql-hackers

From Rajeev rastogi
Subject Re: COPY table FROM STDIN doesn't show count tag
Date
Msg-id BF2827DCCE55594C8D7A8F7FFD3AB7713DDAD110@SZXEML508-MBX.china.huawei.com
Whole thread Raw
In response to COPY table FROM STDIN doesn't show count tag  (Rajeev rastogi <rajeev.rastogi@huawei.com>)
Responses Re: COPY table FROM STDIN doesn't show count tag  (Amit Khandekar <amit.khandekar@enterprisedb.com>)
List pgsql-hackers
<div class="WordSection1"><p class="MsoNormal" style="margin-bottom:12.0pt">On 21 November 2013, Amit Khandekar <<a
href="mailto:amit.khandekar@enterprisedb.com">amit.khandekar@enterprisedb.com</a>>wrote:<p class="MsoNormal">>Ok.
wewill then first fix the \COPY TO issue where it does not revert back the overriden psql output file handle. Once this
issolved, fix for both COPY FROM and COPY TO, like how it is done in the patch earlier (<span
style="font-size:9.5pt;font-family:"Arial","sans-serif"">copydefectV2.patch).</span><pclass="MsoNormal"> <p
class="MsoNormal">Ianalyzed the solution to fix \COPY TO issue but unfortunately I observed that <i>do_copy</i> is
alreadyresetting the value of <i>cur_cmd_source and queryFout</i> but before that itself result status is printed. So
we’llhave to reset the value before result status is being displayed.<p class="MsoNormal"> <p class="MsoNormal">So as
otheralternative solutions, I have two approaches:<p class="MsoListParagraph" style="text-indent:-18.0pt;mso-list:l0
level1lfo1"><span style="mso-list:Ignore">1.<span style="font:7.0pt "Times New Roman"">      </span></span>We can store
currentfile destination <i>queryFout </i>in some local variable and pass the same to <i>SendQuery</i> function as a
parameter.Same can be used to reset the value of queryFout after return from ProcessResult<p
class="MsoListParagraph">Fromall other callers of SendQuery , we can pass NULL value for this new parameter.<p
class="MsoListParagraph"style="text-indent:-18.0pt;mso-list:l0 level1 lfo1"><span style="mso-list:Ignore">2.<span
style="font:7.0pt"Times New Roman"">      </span></span>We can add new structure member variable FILE *prevQueryFout in
structure“struct _<i>psqlSettings”, </i>which hold the value of queryFout before being changed in do_copy. And then
samecan be used to reset value in SendQuery or ProcessResult.<p class="MsoNormal"> <p class="MsoNormal">Please let me
knowwhich approach is OK or if any other approach suggested.<p class="MsoNormal">Based on feedback I shall prepare the
newpatch and share the same.<p class="MsoNormal"> <p class="MsoNormal">Thanks and Regards,<p class="MsoNormal">Kumar
RajeevRastogi<p class="MsoNormal"> <p class="MsoNormal"> </div> 

pgsql-hackers by date:

Previous
From: AK
Date:
Subject: Why is UPDATE with column-list syntax not implemented
Next
From: David Fetter
Date:
Subject: Re: Status of FDW pushdowns