COPY

Started by Nonameover 23 years ago2 messagesgeneral
Jump to latest
#1Noname
linux_211@hotmail.com

I am using the copy command for copy very large database. But I am
using it like it's described in tutorial "copy table from
'/file'..etc". So it takes a lot of time copy each table. Is there any
way how to create some function to copy all the directory ,or
something like foreach (table)...? That directory would contain
prepared tables already. I do not know lot about PostgreSQL functions
,so I am asking some advice.

#2Alvaro Herrera
alvherre@atentus.com
In reply to: Noname (#1)
Re: COPY

igor dijo:

I am using the copy command for copy very large database. But I am
using it like it's described in tutorial "copy table from
'/file'..etc". So it takes a lot of time copy each table. Is there any
way how to create some function to copy all the directory ,or
something like foreach (table)...? That directory would contain
prepared tables already. I do not know lot about PostgreSQL functions
,so I am asking some advice.

It should be very simple to write on in Perl or shell to do that,
something like

for i in /where/dumps/reside/*.dump; do
psql -c "copy table from $i" && mv $i $i.old
done

--
Alvaro Herrera (<alvherre[a]atentus.com>)
La web junta la gente porque no importa que clase de mutante sexual seas,
tienes millones de posibles parejas. Pon "buscar gente que tengan sexo con
ciervos incendi�nse", y el computador dir� "especifique el tipo de ciervo"
(Jason Alexander)