Re: scripting & psql issues

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Bob Parkinson <rwp(at)biome(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org, dino_vliet(at)yahoo(dot)com
Subject: Re: scripting & psql issues
Date: 2004-08-19 10:17:34
Message-ID: 1092910654.19932.44.camel@braydb
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2004-08-18 at 16:26, Bob Parkinson wrote:
> I've started to use the "here document" idea a lot when writing scripts to do tasks.
>
> #!/usr/local/bin/bash
>
> psql -d myDB <<EOSQL
>
> select foo ....
> update bar;
> delete from ...
>
> EOSQL

If the here document is long and complicated, you should make that
command line

psql -d myDB -f - <<EOSQL

so as to get the line number of any error (counting from the start of
the here document).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2004-08-19 10:29:51 Re: Stored Procedures woes
Previous Message Oliver Elphick 2004-08-19 10:14:20 Re: libpq: passwords WAS: scripting & psql issues