pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Geoffrey <esoteric@3times25.net>
To: pgsql-sql@postgresql.org
Subject: Re: [despammed] Insert psql commands inside a script
Date: Sat, 23 Apr 2005 08:15:48 -0400
Message-ID: <426A3C74.8040309@3times25.net> (raw)
In-Reply-To: <20050423060538.GA19935@webserv.wug-glas.de>
References: <2F1DE8CC97C00645B9FEA539982DA22401900D5A@USEA-EXCH4.na.uis.unisys.com>
	<20050423060538.GA19935@webserv.wug-glas.de>

Andreas Kretschmer wrote:
> am  21.04.2005, um 17:19:23 -0500 mailte Letnes, David G. folgendes:
> 
>>  I have used the psql -f /tmp/SelectCommands.sql before, but now I want
>>to put the sql statement right in the shell script.  I haven't had any
>>luck.  Is there a command I can use that will not point to a file for
>>the sql instructions but right on the same line.  I use very short psql
>>commands and would like to do it all with 1 file.
> 
> 
> echo "select bla from fasel" | psql -U <username> database
> 
> You can also use here documents, shell-variables and so on.

Or you can do the following:

psql database < sqlcode

where sqlcode contains your sql.

-- 
Until later, Geoffrey



view thread (6+ messages)  latest in thread

Message-ID: <426A3C74.8040309@3times25.net>
Permalink:  ../426A3C74.8040309@3times25.net/
Also on:    postgresql.org/message-id/426A3C74.8040309@3times25.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: esoteric@3times25.net
  Subject: Re: [despammed] Insert psql commands inside a script
  In-Reply-To: <426A3C74.8040309@3times25.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox