From: Jim.Nasby@BlueTreble.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13960: plpython fails with certain function names
Date: Mon, 15 Feb 2016 00:14:47 +0000
Message-ID: <20160215001447.2605.36302@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: Jim.Nasby@BlueTreble.com
Subject: Re: BUG #13960: plpython fails with certain function names
In-Reply-To: <20160215001447.2605.36302@wrigleys.postgresql.org>
References: <20160215001447.2605.36302@wrigleys.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox