Re: BUG #13960: plpython fails with certain function names

Поиск
Список
Период
Сортировка
Искать
От
Jim Nasby
Тема
Re: BUG #13960: plpython fails with certain function names
Дата
Msg-id
56C12241.2030107@BlueTreble.com
Ответ на
Список
Дерево обсуждения
BUG #13960: plpython fails with certain function names Jim.Nasby@BlueTreble.com
Re: BUG #13960: plpython fails with certain function names Tom Lane <tgl@sss.pgh.pa.us>
Re: BUG #13960: plpython fails with certain function names Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: BUG #13960: plpython fails with certain function names Tom Lane <tgl@sss.pgh.pa.us>
Re: BUG #13960: plpython fails with certain function names Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: BUG #13960: plpython fails with certain function names Tom Lane <tgl@sss.pgh.pa.us>
Re: BUG #13960: plpython fails with certain function names Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: BUG #13960: plpython fails with certain function names Tom Lane <tgl@sss.pgh.pa.us>
Re: BUG #13960: plpython fails with certain function names Pedro Gimeno <parigalo@formauri.es>
Re: BUG #13960: plpython fails with certain function names Jim Nasby <Jim.Nasby@BlueTreble.com>
On 2/14/16 6:49 PM, Tom Lane wrote:
> Jim.Nasby@BlueTreble.com writes:
>> If a Postgres function contains characters that are illegal for python
>> identifiers, compilation fails. Error message is not very helpful either:
>
> Hm, how much do we really care?  The example seems kinda artificial.

I did run across it creating cast functions programmatically, roughly as

format( 'CREATE FUNCTION "ndarray_to_%1s"', input_type::regtype )

which blows up when you feed it something like float. The actual example 
was doing something similar but for an array.

I agree it's not exactly a high priority thing to support, but the error 
text is completely useless unless you happen to know that plpython is 
creating an actual python function.

>> One possibility is to simply strip out invalid characters[1].
>
> No, because then you would get collisions, ie function names that look
> different to PG would look the same to python.  Bad news.

IIRC we append the regproc OID to ensure it's unique.

> (Actually, don't we have that issue anyway because of schemas?  I wonder
> why we are exposing the PG name of the function to python at all.)

Not sure. Maybe useful in a call stack inside python? I can't really 
think of what else you'd use it for. (I assume you're suggesting just 
call the function names something like plpython_.)
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
В списке pgsql-bugs по дате отправления
От: Tom Lane
Дата:
От: Tom Lane
Дата:
FAQ