postgresql plpython bug
Jonathan Ellis
jbellis at gmail.com
Wed May 4 19:07:28 EDT 2005
Mage wrote:
> create or replace function trigger_keywords_maintain() returns
trigger as $$
> return 'MODIFY'
> $$ language plpythonu;
>
> update table set id = id where id = 7;
>
> ERROR: invalid input syntax for type timestamp: "2005-05-03
> 14:07:33,279213"
>
> I see that Python's timestamp format is not accepted by postgresql.
First, you don't give enough context to see where your python code
generates a timestamp, but in any case it's more of a limitation than a
bug that plpython doesn't try to autoconvert certain datatypes. (Are
you even returning a datetime class, or a string?)
You could play around with strftime to try to get something postgresql
will recognize, but it's probably easier to just return an epoch value
which you can turn into a postgresql timestamp with the abstime
function.
-Jonathan
More information about the Python-list
mailing list