Pergunta

I know a query runs until it returns data when connection to the client is lost. However, what if you use pg_restore. Does it upload the restore file and then does the restore on the server? Or does it restore step by step requiring the client to stay connected.

I want to know this because my employee uses a vpn that disconnects automatically after some time. And the restore takes longer that the timeout XD.

When the connection got lost I got the pg_restore: error: error returned by PQputCopyData: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. error.

However on the server I can see the process is still up and running using SELECT * FROM pg_stat_activity;

Foi útil?

Solução

pg_restore keeps executing SQL statements on the server. If the connection to the server fails, the restore was not successful.

What is strange here is that there should not be any long idle times in the connection, with the possible exception of creating indexes and refreshing materialized views.

At any rate, you should see that the network gets configured properly. You cannot really work with an unreliable network like that that drops your connection as soon as you turn your back.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a dba.stackexchange
scroll top