Received: from www-uk-05.digiserve.com ([195.97.231.11]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f31H4IK24605 for ; Sun, 1 Apr 2001 13:04:18 -0400 (EDT) (envelope-from dev@archonet.com) Received: from mainbox.archonet.com (mwynhau.demon.co.uk [193.237.186.96]) by www-uk-05.digiserve.com (8.9.1/8.9.1) with ESMTP id SAA07247; Sun, 1 Apr 2001 18:05:14 +0100 (BST) Received: from archonet.com (ibook.archonet.com [192.168.1.32]) by mainbox.archonet.com (Postfix) with ESMTP id 6FE902A2E3; Sun, 1 Apr 2001 17:36:12 +0100 (BST) Message-ID: <3AC758D6.41FDD33C@archonet.com> Date: Sun, 01 Apr 2001 17:35:35 +0100 From: Richard Huxton X-Mailer: Mozilla 4.7C-CCK-MCD {C-UDP; EBM-APPLE} (Macintosh; I; PPC) X-Accept-Language: en MIME-Version: 1.0 To: Stef Telford Cc: pgsql-sql@postgresql.org Subject: Re: Trigger Function and Html Output References: <01040103502000.12630@devil.hades> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200104/3 X-Sequence-Number: 2342 Stef Telford wrote: > > Hello, > i find i must turn once again to the list for help, in what > is probably another silly request. That's what the list is for, and it's only silly if you already know the answer :-) > The long and short of it is this, I would like the view to > return a html table. I understand that I can do this via a function > and a trigger on select, massage the data, and then construct > each line to simply be returned to the perl program. The only > problem comes with, as far as i am aware, a trigger returns and > is processed on a 'per line' basis for a select, so how would i > get the view's column titles output for the table header ? For this sort of stuff, I like to make as much use of Perl's DBI and HTML templating modules as I can. For the templating, it's trivial to write your own stuff for this sort of problem, but have a look at the various modules on CPAN - there'll be something there for you. I've got to admit, I try to avoid using SELECT * if I can - maybe it's just me, but I've always felt if the database changes the code needs to break. I'd rather get errors than unexpected results. IMHO of course. > I ideally want to make as much of the perl construction > of the table from the database, this includes the head of the table, > all and each row, and then of course closing the table 'off'. I know > this sounds like a strange way to do things, but i think this is the > best way to go. Definitely look at some of the general-purpose templating modules. They'll all handle tables. - Richard Huxton