Re: [SQL] bash & postgres

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erik Jones <ejones(at)engineyard(dot)com>
Cc: Greenhorn <user(dot)postgresql(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] bash & postgres
Date: 2009-03-23 14:05:02
Message-ID: 8330.1237817102@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Erik Jones <ejones(at)engineyard(dot)com> writes:
> On Mar 22, 2009, at 9:03 PM, Greenhorn wrote:
>> How do I use \c (or any other psql commands beginning with a "\") in a
>> bash script?

> For multi-line input to a psql call in a bash (or any decent shell)
> script, I'd use a here document:

Or echo/cat the script into psql's stdin, if you prefer that type of
notation. The reason you have to do this is that psql doesn't recognize
backslash commands in a -c string. There's a school of thought that
doesn't want us to allow multiple commands in a -c string, even.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message jrufener 2009-03-23 14:45:51 problem with at proramn
Previous Message Dave Page 2009-03-23 14:02:15 Re: debugging in pgadmin

Browse pgsql-sql by date

  From Date Subject
Next Message Joshua Tolley 2009-03-23 14:33:27 Re: cast bool/int
Previous Message Achilleas Mantzios 2009-03-23 08:18:31 Re: cast bool/int