Re: Need help with bash script and postgresql

Поиск
Список
Период
Сортировка
От Ow Mun Heng
Тема Re: Need help with bash script and postgresql
Дата
Msg-id 1185185087.10048.14.camel@neuromancer.home.net
обсуждение исходный текст
Ответ на Need help with bash script and postgresql  ("Chuck Payne" <cpayne@magigames.net>)
Список pgsql-general
On Mon, 2007-07-23 at 05:34 -0400, Chuck Payne wrote:
>
> Hey,
>
> I have spend the last several days looking for a website or how to
> that would show me how to call postgresql in bash script. I know that
> in mysql I can do like this
>
> for i in `cat myfile.txt` ; do mysql -uxxx -pxxxx -Asse mydatabase
> "insert into mytable  (aaa,bbb) values ("xxx", "yyy");"
>
> I have tried to do what with pgsql and it not working. I have looked
> at my two books I have and they are very limited.
>
> Can some what tell if postgre has flag like -Asse? Or show me a simple
> script they have do that is kinda like above.

I can't really offer any help yet.. (still playing with it)
but.. can't you do use copy instead of inserts?

eg: psql -U xxx -W DBname -c "\copy from '/tmp/myfile.txt' with csv
header"


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

Предыдущее
От: "Andy Dale"
Дата:
Сообщение: Re: Need help with bash script and postgresql
Следующее
От: "Pavel Stehule"
Дата:
Сообщение: Re: Need help with bash script and postgresql