From: | "Moray McConnachie" <moray(dot)mcconnachie(at)computing-services(dot)oxford(dot)ac(dot)uk> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | function to provide part of function (language='sql') |
Date: | 1999-09-30 17:26:56 |
Message-ID: | 022001bf0b68$fec682b0$760e01a3@oucs.ox.ac.uk |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi, all.
I need to write functions along these lines:
CREATE FUNCTION functiongetfieldname(char) RETURNS varchar
AS 'SELECT fieldname FROM listoffields WHERE criterion=$1;' LANGUAGE
'sql'
CREATE FUNCTION blah(char,int2) RETURNS float
AS 'SELECT functiongetfieldname($1) FROM maintable WHERE
secondcriterion=$2;'
However, the second function obviously only returns the fieldname
returned by the first function. What I want it to do is return the
contents of the field whose name is returned by the first function. Is
this possible?
Alternative ways round considered, but I'd prefer not to mess with the
database design....
Thanks,
Moray
----------------------------------------------------------------------
----------------
Moray(dot)McConnachie(at)computing-services(dot)oxford(dot)ac(dot)uk
From | Date | Subject | |
---|---|---|---|
Next Message | Doran L. Barton | 1999-09-30 22:21:47 | Keeping postmaster running or restarting |
Previous Message | Rissman | 1999-09-30 16:15:26 | Red Hat 6.0 / Postgresql 6.4.2 Installed / How to manage? Where are docs? |