Re: Need help with bash script and postgresql

From: "Andy Dale" <andy(dot)dale(at)gmail(dot)com>
To: cpayne(at)magigames(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Need help with bash script and postgresql
Date: 2007-07-23 10:04:08
Message-ID: faa313130707230304w2982c197ga2775cdb82b19ba1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Chuck,

I am no expert but this should definitely be possible with postgres.

The posgres command in the loop should look like so (not sure about the
password):

psql -U <user> -d mydatabase -c ""insert into mytable (aaa,bbb) values
('xxx', 'yyy');"

Cheers,

Andy

On 23/07/07, Chuck Payne <cpayne(at)magigames(dot)net> 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.
>
> Thanks,
>
> Payne
>
> ----------------------------------------------------
> www.britishscifiexchange.com
> www.magigames.net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ow Mun Heng 2007-07-23 10:04:47 Re: Need help with bash script and postgresql
Previous Message Chuck Payne 2007-07-23 09:34:37 Need help with bash script and postgresql