Re: Multiple COPYs

Поиск
Список
Период
Сортировка
От Douglas McNaught
Тема Re: Multiple COPYs
Дата
Msg-id m2wtotukcu.fsf@Douglas-McNaughts-Powerbook.local
обсуждение исходный текст
Ответ на Multiple COPYs  (rasdj@frontiernet.net)
Список pgsql-general
rasdj@frontiernet.net writes:

> Hello,
>
> Having a great time with PG - ported an erp from oracle and db2. First
> I tried MySql but choked somewhere in the 900 table region. I have a
> python script to translate the syntax and it loads about 2000 tables.
>
> Now I want to COPY my dumps - I have 1 data dump for each table. Any
> tips on what to use so that I can read the file name into a variable
> and pass it as the file name in the COPY command and have one script
> load all my tables?

Should be pretty easy from the shell, something like (untested):

for f in *.sql; do
  tablename=`basename $f .sql`
  psql -c "\\copy $tablename from $f" mydatabase
done

-Doug

В списке pgsql-general по дате отправления:

Предыдущее
От: Douglas McNaught
Дата:
Сообщение: Re: Help: chinese character set support (EUC_TW to/from BIG5 conversion)
Следующее
От: Bruce Momjian
Дата:
Сообщение: Change to make strings SQL-standard