Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

BUG #13960: plpython fails with certain function names - Mailing list pgsql-bugs

From Jim.Nasby@BlueTreble.com
Subject BUG #13960: plpython fails with certain function names
Date
Msg-id 20160215001447.2605.36302@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #13960: plpython fails with certain function names
List 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 by date:

Previous
From: Andres Freund
Date:
Subject: Re: Standbys using commas in application_name cannot become sync nodes
Next
From: Michael Paquier
Date:
Subject: Re: Standbys using commas in application_name cannot become sync nodes