From: Andrew G. Hammond <drew@xyzzy.dhs.org>
To: Jean-Luc Lachance <jllachan@nsd.ca>
Cc: pgsql-sql@postgresql.org
Cc: pgsql-general@postgresql.org
Subject: Re: [SQL] How to create crude report with psql and/or plpgsql
Date: Tue, 19 Mar 2002 13:41:09 -0500
Message-ID: <20020319184109.GC23827@xyzzy.dhs.org> (raw)
In-Reply-To: <3C978469.38387B8C@nsd.ca>
References: <2266D0630E43BB4290742247C89105758DCAB6@dozer.computec.de>
<3C977E7E.D2EC1CF0@nsd.ca>
<20020319182116.GB23827@xyzzy.dhs.org>
<3C978469.38387B8C@nsd.ca>
On Tue, Mar 19, 2002 at 01:33:13PM -0500, Jean-Luc Lachance wrote:
> I do not need HTML, just plain text
So just do it in plain text then:
#!/bin/sh
echo <<END
This is plain text. It's not that hard.
END
psql --command 'SELECT * FROM foo' my_dbase
echo <<END
This is more plain text. Still pretty simple, eh?
END
You may also want to RTFM in the psql manual about \pset and the -f
option.
> or maybe PDF.
Please don't use bad words. PDF is a proprietary format. Beware.
> It would be nice if there was one extra level for RAISE as in:
> RAISE PRINT 'Whatever'
> That would not send the message the log but only to the console.
> One could do alot with that.
Something wrong with using
SELECT 'whatever';
or didn't you even read as far as the end of my first message?
> "Andrew G. Hammond" wrote:
> >
> > On Tue, Mar 19, 2002 at 01:07:58PM -0500, Jean-Luc Lachance wrote:
> >
> > > I did not find any kind of print statement in psql or plpgsql.
> > > So, how can I create basic report with psql and/or plpgsql?
> > > Nothing fancy, page header/footer sub-totals per page.
> >
> > Errr... psql is a database query tool. There's not much available
> > for doing that kind of thing. That said, why not just write a
> > script to do it:
> >
> > #!/bin/sh
> > echo <<END
> > <html><head><title>This is a title</title></head>
> > <body>
> > <!-- header -->
> > END
> >
> > # do the query
> > psql --html --command 'SELECT * FROM foo' my_dbase
> >
> > echo <<END
> > <!-- footer -->
> > </body></html>
> > END
> >
--
Andrew G. Hammond mailto:drew@xyzzy.dhs.org http://xyzzy.dhs.org/~drew/
56 2A 54 EF 19 C0 3B 43 72 69 5B E3 69 5B A1 1F 613-389-5481
5CD3 62B0 254B DEB1 86E0 8959 093E F70A B457 84B1
"To blow recursion you must first blow recur" -- me
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: drew@xyzzy.dhs.org, jllachan@nsd.ca, pgsql-general@postgresql.org
Subject: Re: [SQL] How to create crude report with psql and/or plpgsql
In-Reply-To: <20020319184109.GC23827@xyzzy.dhs.org>
* 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