Re: plpython error since upgrading from 7.x to 8.x

From: CSN <cool_screen_name90001(at)yahoo(dot)com>
To: Michael Fuhr <mike(at)fuhr(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: plpython error since upgrading from 7.x to 8.x
Date: 2005-05-25 19:02:22
Message-ID: 20050525190222.44630.qmail@web52903.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


It happens when I try to insert rows:

insert into table1 (col1, col2, col3) values (val1,
val2, val3);

I have an insert/update trigger on that table, and the
plpythonu function just sends a notification email.
Here's the function:

if TD["new"]["active"] != TD["old"]["active"]:

import smtplib
import string

fromaddr = "admin(at)mydomain(dot)com"
toaddr = "admin(at)yourdomain(dot)com"

if TD["new"]["active"] == 1:

msg = "From: %s\r\nTo: %s\r\nSubject:
Approved\r\n\r\n" % (fromaddr, toaddr)

msg = msg + """Greetings,
...
"""

else:
msg = "From: %s\r\nTo: %s\r\nSubject: New
Record\r\n\r\n" % (fromaddr, toaddr)

msg = msg + """Greetings,
...
"""

server = smtplib.SMTP("localhost")
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddr, msg)
server.quit()

#####################

I also recently switched to Dbmail, so maybe that
caused a problem (but mail works fine with everything
else).

CSN

--- Michael Fuhr <mike(at)fuhr(dot)org> wrote:
> On Wed, May 25, 2005 at 02:04:22AM -0700, CSN wrote:
> >
> > I had a plpythonu function that worked in 7.x but
> > since upgrading to 8.x it's giving this error:
> >
> > ERROR: plpython: function "notify" failed
> > DETAIL: exceptions.TypeError: unsubscriptable
> object
>
> Could you post a simple, self-contained example that
> exhibits this
> problem? Debugging would be easier if we could see
> what you're doing.
>
> --
> Michael Fuhr
> http://www.fuhr.org/~mfuhr/
>


__________________________________
Yahoo! Mail
Stay connected, organized, and protected. Take the tour:
http://tour.mail.yahoo.com/mailtour.html

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aly Dharshi 2005-05-25 20:11:43 Compiling Postgresql 8.0.3 on Solaris 10
Previous Message Manuel García 2005-05-25 17:32:03 Advice