dbTalk Databases Forums  

[BUGS] SPI_getvalue calls output function w/o pushing existing SPI

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] SPI_getvalue calls output function w/o pushing existing SPI in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
J. Greg Davidson
 
Posts: n/a

Default [BUGS] SPI_getvalue calls output function w/o pushing existing SPI - 12-12-2006 , 01:34 AM






I have a user defined type implemented in C and SPI which has been
crashing a lot. I found a small enough case to trace the whole thing
with gdb and found that while connected to SPI I was doing a get_value
on a type T implemented in C and SPI. SPI_getvalue led to a call to T's
output routine which called SPI_connect which failed because the
previous SPI connection was still in force. The whole transaction was
aborted, so without a long gdb session I wouldn't have caught it.
Ironically the call to SPI_getvalue was in my debugging code!

This behavior was unexpected and very hard to track down. If
SPI_getvalue is supposed to be this fragile, it would be good to
document that. I'm now experimenting with creating a wrapper function
which surrounds SPI_getvalue with SPI_push and SPI_pop.

On a related issue - it would be very handy to have something which can
be called or tested from a type extension module to find out if an SPI
connection exists. Such a feature would be especially useful for
asserts. As far as I can tell from reading the server code, any such
state is hidden in static variables.

Finally, I tried to submit this bug at
http://wwwmaster.postgresql.org/system/handleform.php
as requested by the documentation at PostgreSQL.org, but it rejected my
attempt saying "The email address you entered does not appear to be
valid." The email address in question is "jgd (AT) well (DOT) com" which is
indeed valid and is the one I use to receive postgresql mailing lists.

Thanks for reading this feedback and keep up the good work,

_Greg

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.