Re: callproc type casts
Daniele Varrazzo <[email protected]> Wed, 11 Aug 2010 18:34:19 +0100
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed, Aug 11, 2010 at 6:11 PM, Imre Horvath <[email protected]> wrote: > I've got another problem with a (bigint, smallint) function too. > > cursor.callproc('testfunc', (10000, 0)) don't work > cursor.execute('select * from testfunc(10000, 0)) don't work > cursor.execute('select * from testfunc(10000::bigint, 0::smallint)) > works > > in the first 2 cases, it casts to (integer, integer) > can I specify explicit casts to callproc with psycopg2? Not that I know, but I've hardly ever used callproc (I was surprised yesterday when I saw its return value...) There are approaches that may work, but are too convoluted to be practical (subclassing int and adding an adapter... ugh!). I think it's better to add the PostgreSQL cast to a SELECT. By the way I suspect PostgreSQL itself may have a hard time deciding which function to use, if you have overloaded functions such that (bigint, smallint) arguments can't be inferred from (integer, integer). -- Daniele