X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 910E0535D5 for ; Sat, 23 Apr 2005 09:15:55 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21444-03 for ; Sat, 23 Apr 2005 12:15:47 +0000 (GMT) Received: from 3times25.net (66-23-211-34.clients.speedfactory.net [66.23.211.34]) by svr1.postgresql.org (Postfix) with ESMTP id B9E195335E for ; Sat, 23 Apr 2005 09:15:46 -0300 (ADT) Received: from [127.0.0.1] (rhws.home.edu [127.0.0.1]) by 3times25.net (Postfix) with ESMTP id 7A24B743DB for ; Sat, 23 Apr 2005 08:15:49 -0400 (EDT) Message-ID: <426A3C74.8040309@3times25.net> Date: Sat, 23 Apr 2005 08:15:48 -0400 From: Geoffrey User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050322 Red Hat/1.7.6-1.4.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: [despammed] Insert psql commands inside a script References: <2F1DE8CC97C00645B9FEA539982DA22401900D5A@USEA-EXCH4.na.uis.unisys.com> <20050423060538.GA19935@webserv.wug-glas.de> In-Reply-To: <20050423060538.GA19935@webserv.wug-glas.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.04 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200504/356 X-Sequence-Number: 21249 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 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