pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jan Wieck <janwieck@Yahoo.com>
To: Ken Corey <ken@kencorey.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Hrm...why is this wrong?
Date: Thu, 8 Feb 2001 04:38:44 -0500 (EST)
Message-ID: <200102080938.EAA02707@jupiter.greatbridge.com> (raw)
In-Reply-To: <0102042025020D.18716@kenlinux.bithub.org>

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 <ken@kencorey.com> 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




view thread (6+ messages)

Message-ID: <200102080938.EAA02707@jupiter.greatbridge.com>
Permalink:  ../200102080938.EAA02707@jupiter.greatbridge.com/
Also on:    postgresql.org/message-id/200102080938.EAA02707@jupiter.greatbridge.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: janwieck@Yahoo.com, ken@kencorey.com, tgl@sss.pgh.pa.us
  Subject: Re: Hrm...why is this wrong?
  In-Reply-To: <200102080938.EAA02707@jupiter.greatbridge.com>
  References: <0102042025020D.18716@kenlinux.bithub.org> <200102080938.EAA02707@jupiter.greatbridge.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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