Received: from mailin2.email.bigpond.com ([139.134.6.23]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f214ZGx63001 for ; Wed, 28 Feb 2001 23:35:16 -0500 (EST) (envelope-from aa2@bigpond.net.au) Received: from bigpond.net.au ([139.134.4.57]) by mailin2.email.bigpond.com (Netscape Messaging Server 4.15) with SMTP id G9I4CV01.M1O for ; Thu, 1 Mar 2001 14:26:55 +1000 Received: from CPE-144-132-75-163.vic.bigpond.net.au ([144.132.75.163]) by mail2.bigpond.com (Claudes-Reliable-MailRouter V2.9c 3/5081966); 01 Mar 2001 14:22:10 Message-ID: <3A9DCE37.C6C25F5@bigpond.net.au> Date: Thu, 01 Mar 2001 15:21:11 +1100 From: Justin Clift X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.17-21mdk i686) X-Accept-Language: en MIME-Version: 1.0 To: PostgreSQL SQL Mailing list Subject: Re: Help needed -> ERROR: record arow has no field description References: <3A9DAD09.E1FBBA50@bigpond.net.au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/436 X-Sequence-Number: 1641 Hi all, Solved my own problem. I was just misreading the error message. It was actually TELLING me the problem (I was referencing a table with no field called "description" in the select, but trying to use it in the loop. Sorry for disturbing people. As an aside, this has motivated me to add a section on error messages into techdocs.postgresql.org (very messy at the moment, I'll fix it tonight). Regards and best wishes, + Justin Clift Database Administrator Justin Clift wrote: > > Hi all, > > I'm getting this error, which to me makes no sense. Running PostgreSQL > 7.0.3 on Mandrake 7.2 (compiled from source, not the rpms). > > The code is in a pl/pgsql function I am writing and I can't see why it's > complaining. > > This is the appropriate part of the code : > > > > arow record; > > > > BEGIN > > > > FOR arow IN select transaction_payments.cashback from > transaction_payments, payment_types where > transaction_payments.payment_type = payment_types.idnum LOOP > textbuf := text(arow.cashback); > textbuf := textcat(textbuf, '' ''); > insert into receipts (receipt_num, data) values (trans_num, > textbuf); > END LOOP; > > > > >From the PostgreSQL log file (debug is set to 2), I am getting : > > query: SELECT transaction_payments.cashback from transaction_payments, > payment_types where transaction_payments.payment_type = > payment_types.idnum > ERROR: record arow has no field description > DEBUG: Last error occured while executing PL/pgSQL function > create_receiptp3 > DEBUG: line 105 at assignment > AbortCurrentTransaction > > The "arow" record type variable is used quite a lot in previous FOR > loops in this function. This is the first FOR loop in the function that > uses more than one table though. I suspect this may have something to > do with it. > > As far as I can tell, this SQL statement is valid. Does anyone have any > ideas how to get this to work. I have tried several variations, and the > mailing lists don't even have a reference for this error message. > > Regards and best wishes, > > Justin Clift > Database Administrator