Received: from smtp4.mail.yahoo.com (smtp4.mail.yahoo.com [128.11.69.101]) by mail.postgresql.org (8.11.1/8.11.1) with SMTP id f18B4qx89935 for ; Thu, 8 Feb 2001 06:04:52 -0500 (EST) (envelope-from janwieck@yahoo.com) Received: from a61a4.pppool.de (HELO jupiter.greatbridge.com) (213.6.97.164) by smtp.mail.vip.suc.yahoo.com with SMTP; 8 Feb 2001 11:04:48 -0000 X-Apparently-From: Received: (from janwieck@localhost) by jupiter.greatbridge.com (8.9.3/8.9.3) id EAA02707; Thu, 8 Feb 2001 04:38:44 -0500 From: Jan Wieck Message-Id: <200102080938.EAA02707@jupiter.greatbridge.com> Subject: Re: Hrm...why is this wrong? In-Reply-To: <0102042025020D.18716@kenlinux.bithub.org> from Ken Corey at "Feb 4, 2001 08:25:02 pm" To: Ken Corey Date: Thu, 8 Feb 2001 04:38:44 -0500 (EST) CC: Tom Lane , pgsql-sql@postgresql.org X-Mailer: ELM [version 2.4ME+ PL68 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archive-Number: 200102/151 X-Sequence-Number: 1331 Ken Corey wrote: > Wow! Answering emails on a Sunday? Someone should be giving you an award or > something. > > On Sunday 04 February 2001 8:13 pm, you wrote: > > Ken Corey writes: > > > When the select at the bottom of this email is executed, I'm getting the > > > message: > > > ERROR: parser: parse error at or near "$1" > > > > I don't get that; I get > > ERROR: Attribute 'username_in' not found > > which is about what I'd expect for the given function text; maybe you > > didn't transcribe it accurately? > > That's strange...perhaps the difference was a problem with my table > definition? *shrug* I also had made a few mistakes, so once I got those > fixed, the code seems to work again. > > > Anyway, an invaluable technique for debugging plpgsql functions is to > > start psql with debug level 2, so that the queries the plpgsql executor > > feeds to the SQL engine get logged in the postmaster log. (If you don't > > run the postmaster with a logfile, you should...) For example: > > Hey, that's perfect. It's okay just so long as the debugging out goes > *somewhere*...:^) Another lesser known trick is to add #option dump at the top of the function body (before DECLARE). This causes the PL/pgSQL compiler to dump out the entire function after parsing where you can see all the SPI queries that later will get executed. Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #================================================== JanWieck@Yahoo.com # _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com