Subject: code in docs gives me an error

From: "Hicham G. Elmongui" <[email-masked]>
Date: Tue, 19 Oct 2004 09:21:26 -0500

Hi
I tried creating the function (from sec 19.3.1). But it gives me the
following error: "ERROR:  type tablename does not exist".
Any ideas of what i might be doing wrong?

CREATE FUNCTION use_many_fields(tablename) RETURNS TEXT AS '
DECLARE
    in_t ALIAS FOR $1;
BEGIN
    RETURN in_t.f1 || in_t.f3 || in_t.f5 || in_t.f7;
END;
' LANGUAGE 'plpgsql';

Thanks,
--Hicham

---

From: Oliver Elphick <[email-masked]>
Date: Wed, 20 Oct 2004 16:52:50 +0100

> CREATE FUNCTION use_many_fields(tablename) RETURNS TEXT AS '

You are passing a composite type for a row from the table called
"tablename"; such a table does not exist.  Use the name of a table that
actually exists (and has the fields named in the RETURN statement).

-- 
Oliver Elphick                                          [email-masked]
Isle of Wight                              http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA  92C8 39E7 280E 3631 3F0E  1EC0 5664 7A2F A543 10EA
                 ========================================
     "For the LORD God is a sun and shield; the LORD will 
      give grace and glory; no good thing will he withhold 
      from them that walk uprightly."        Psalms 84:11