Skip site navigation (1) Skip section navigation (2)

Re: psql in bash scrpts, is possible ?

From: Lonni J Friedman <netllama(at)gmail(dot)com>
To: Mariateresa L <mariateresa(dot)ll(at)bresciaonline(dot)it>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: psql in bash scrpts, is possible ?
Date: 2010-05-31 21:25:26
Message-ID: AANLkTik-VtBpOd0VpuvFrttQbuoXHmEYL9W32O0XDu4N@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Mon, May 31, 2010 at 2:02 PM, Mariateresa L
<mariateresa(dot)ll(at)bresciaonline(dot)it> wrote:
>
> Hello everyone,
>
> I'm building a small newspaper informations aggregator around postgresql
> 8.3 and Ubuntu 9.10.
> Starting from a previous experience on Oracle DB, I've built and tested
> a bunch of functions, triggers, SQL scripts etc... that work flawlessly
> (almost !) when I submit them by hand in psql; now I want to pack
> everything in a nice shell script, with proper error control, automated
> file shuffling,  predefined queries in text files and so on, but I
> cannot convince psql that the SQL commands (select, insert or copy...)
> it has to handle come from a file.
> I can submit  ("\i filename" or "psql --file filename") files that
> contains commands, eg starting with "\" but psql does not understand the
> same sintax if tne file contains a simple "SELECT * FROM tablex".
>
> Am I uber-newbie or is this a known limitation of psql ? And, in this
> case, there is something to overcome this limit and afford my non-techie
> user to launch a simple command to print her data or to bulk update tables ?
>
> P.S. Initially I discarded the use of procedural languages (C or ...)
> for a quick and simpler solution !

This works fine for me.  Specifically what isn't working for you?  I
see no errors, or even the commands that you're issuing that are
failing.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
L. Friedman                                    netllama(at)gmail(dot)com
LlamaLand                       https://netllama.linux-sxs.org

In response to

pgsql-novice by date

Next:From: Joe BrennerDate: 2010-05-31 21:37:55
Subject: Re: sql files in psql ?
Previous:From: Tom LaneDate: 2010-05-31 21:14:45
Subject: Re: sql files in psql ?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group