Thread: plpythonu and return void
I recently migrated a database from Postgres 7.4.1 to Postgres 8.03. The only problem I have run into is that a plpythonu function that returns void will not run under 8.03. The error message states that a plpython function cannot return void. I got around it by having it return text and not actually returning anything. I have searched for an explanation and can't seem to locate one. Obviously I have missed something I just don't know what? Any suggestions would be appreciated. -- Adrian Klaver aklaver@comcast.net
Adrian Klaver <aklaver@comcast.net> writes: > I recently migrated a database from Postgres 7.4.1 to Postgres 8.03. The only > problem I have run into is that a plpythonu function that returns void will > not run under 8.03. The error message states that a plpython function cannot > return void. I got around it by having it return text and not actually > returning anything. I have searched for an explanation and can't seem to > locate one. The explanation is doubtless here: 2004-09-19 19:38 tgl * src/pl/plpython/plpython.c: Add defenses against plpython functions being declared to take or return pseudotypes. Not sure why I neglected to add these checks at the same time I added them to the other PLs, but it seems I did. It's certainly possible to weaken this test to allow "void" again, but shouldn't there be corresponding changes elsewhere to ensure that the behavior is actually sensible? regards, tom lane
On Monday 08 August 2005 08:02 pm, Tom Lane wrote: > Adrian Klaver <aklaver@comcast.net> writes: > > I recently migrated a database from Postgres 7.4.1 to Postgres 8.03. The > > only problem I have run into is that a plpythonu function that returns > > void will not run under 8.03. The error message states that a plpython > > function cannot return void. I got around it by having it return text and > > not actually returning anything. I have searched for an explanation and > > can't seem to locate one. > > The explanation is doubtless here: > > 2004-09-19 19:38 tgl > > * src/pl/plpython/plpython.c: Add defenses against plpython > functions being declared to take or return pseudotypes. Not sure > why I neglected to add these checks at the same time I added them > to the other PLs, but it seems I did. > > It's certainly possible to weaken this test to allow "void" again, > but shouldn't there be corresponding changes elsewhere to ensure that > the behavior is actually sensible? > > regards, tom lane Thanks for the explanation. One of these days I will remember that the source is my friend. -- Adrian Klaver aklaver@comcast.net