BUG #13960: plpython fails with certain function names
От | Jim.Nasby@BlueTreble.com |
---|---|
Тема | BUG #13960: plpython fails with certain function names |
Дата | |
Msg-id | 20160215001447.2605.36302@wrigleys.postgresql.org обсуждение исходный текст |
Ответы |
Re: BUG #13960: plpython fails with certain function names
|
Список | pgsql-bugs |
The following bug has been logged on the website: Bug reference: 13960 Logged by: Jim Nasby Email address: Jim.Nasby@BlueTreble.com PostgreSQL version: 9.5.0 Operating system: OS X Description: If a Postgres function contains characters that are illegal for python identifiers, compilation fails. Error message is not very helpful either: ~@decina.local/21474# CREATE FUNCTION "test[]"() RETURNS text LANGUAGE plpythonu AS $$return 'test'$$; ERROR: could not compile PL/Python function "test[]" DETAIL: SyntaxError: invalid syntax (<string>, line 1) ~@decina.local/21474# CREATE FUNCTION "test"() RETURNS text LANGUAGE plpythonu AS $$return 'test'$$; CREATE FUNCTION ~@decina.local/21474# One possibility is to simply strip out invalid characters[1]. What's valid expands in 3.5, but I don't think that really matters. Another possibility would be to catch the python exception, but that's probably more trouble than it's worth. [1] https://docs.python.org/2/reference/lexical_analysis.html#grammar-token-identifier identifier ::= (letter|"_") (letter | digit | "_")* letter ::= lowercase | uppercase lowercase ::= "a"..."z" uppercase ::= "A"..."Z" digit ::= "0"..."9" 3.5: https://docs.python.org/3.5/reference/lexical_analysis.html#grammar-token-identifier
В списке pgsql-bugs по дате отправления: