Re: [SQL] How to create crude report with psql and/or plpgsql

From: "Andrew G(dot) Hammond" <drew(at)xyzzy(dot)dhs(dot)org>
To: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
Cc: pgsql-sql(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [SQL] How to create crude report with psql and/or plpgsql
Date: 2002-03-19 18:21:16
Message-ID: 20020319182116.GB23827@xyzzy.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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

Of course if you really insist on doing it in psql, you could just
write SELECT statements that select a preset string. Ugly, but
it would work:

SELECT '<html><head><title>... '::text;

--
Andrew G. Hammond mailto:drew(at)xyzzy(dot)dhs(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Luc Lachance 2002-03-19 18:33:13 Re: [SQL] How to create crude report with psql and/or plpgsql
Previous Message Travis Bauer 2002-03-19 18:07:59 Re: PL/PGSQL and PL/Perl time issues

Browse pgsql-sql by date

  From Date Subject
Next Message Jean-Luc Lachance 2002-03-19 18:33:13 Re: [SQL] How to create crude report with psql and/or plpgsql
Previous Message Jean-Luc Lachance 2002-03-19 18:07:58 How to create crude report with psql and/or plpgsql