Le 08/10/2019 à 16:03, Adrian Klaver a écrit :
> This is going to be hard to troubleshoot if you change your commands.
>
> Previously you had:
> psql -h %MYPGSERVER% -a -f myscript.sql %MYPGDB%
>
> Changing more then one thing at a time makes it that much more difficult
> to isolate the issue.
Yes, true. Actually I do one change at a time, I'm just no posting every
single attempt. So I tried to feed the script using console redirection
rather than -f as you can see. That was the only change.
> I would create an entirely separate batch file that runs just
> problematicline.sql.
OK, that's easy.
Actually the batch file is not doing much more than running this psql
command, but that's really not a problem/
> Given that you suspect Postgres it would be helpful to see the query
> that underlies the view you are copying.
> You might want to look at autoexplain:
>
> https://www.postgresql.org/docs/11/auto-explain.html
>
> as a way of getting information at run time.
OK that's nice.
Since I don't want to mess with the whole server configuration, I added
some auto_explain settings to my script.
So for tonight, my script looks like this :
LOAD 'auto_explain';
SET auto_explain.log_min_duration = 0;
SET auto_explain.log_analyze = true;
COPY (SELECT * FROM myview) TO STDOUT \g '\\\\myserver\\myshare\\myfile.txt'
And it'll run in a separate batch.
Thanks for your help Adrian !
Regards
--
Arnaud