public inbox for [email protected]  
help / color / mirror / Atom feed
code in docs gives me an error
2+ messages / 2 participants
[nested] [flat]

* code in docs gives me an error
@ 2004-10-19 14:21  Hicham G. Elmongui <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Hicham G. Elmongui @ 2004-10-19 14:21 UTC (permalink / raw)
  To: pgsql-docs

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: code in docs gives me an error
@ 2004-10-20 15:52  Oliver Elphick <[email protected]>
  parent: Hicham G. Elmongui <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Oliver Elphick @ 2004-10-20 15:52 UTC (permalink / raw)
  To: Hicham G. Elmongui <[email protected]>; +Cc: pgsql-docs

On Tue, 2004-10-19 at 15:21, Hicham G. Elmongui wrote:
> 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 '

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).

> DECLARE
>     in_t ALIAS FOR $1;
> BEGIN
>     RETURN in_t.f1 || in_t.f3 || in_t.f5 || in_t.f7;
> END;
> ' LANGUAGE 'plpgsql';

-- 
Oliver Elphick                                          [email protected]
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 





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-10-20 15:52 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-19 14:21 code in docs gives me an error Hicham G. Elmongui <[email protected]>
2004-10-20 15:52 ` Oliver Elphick <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox