Re: plpython bug - Mailing list pgsql-general

From Mage
Subject Re: plpython bug
Date
Msg-id 427A0331.7070606@mage.hu
Whole thread Raw
In response to plpython bug  (Mage <mage@mage.hu>)
List pgsql-general
Update:

it might be not plpython, but similar to the plperl bug I found last time.

The script which can produce the bug:

--------

create table test (id int, date timestamp);

create or replace function trigger_test() returns trigger as $$
plpy.info(TD['new'])
return 'MODIFY'
$$ language plpythonu;

create trigger test_update before update on test for each row execute
procedure trigger_test();

insert into test values (1, now());
insert into test values (2, now());

update test set id = 3;

create or replace function test_perl() returns boolean as $$
    use locale;
    use POSIX qw(locale_h);
    setlocale(LC_COLLATE,'hu_HU');
    setlocale(LC_CTYPE,'hu_HU');
    setlocale(LC_NUMERIC,'hu_HU');
    return True
$$ language plperlu;

create or replace function trigger_test() returns trigger as $$
plpy.info(TD['new'])
plpy.execute('select * from test_perl()')
return 'MODIFY'
$$ language plpythonu;

update test set id = 4;

---------


CREATE TABLE
CREATE FUNCTION
CREATE TRIGGER
INSERT 9138862 1
INSERT 9138863 1
INFO:  ({'date': '2005-05-05 13:20:43.793551', 'id': 3},)
INFO:  ({'date': '2005-05-05 13:20:43.794401', 'id': 3},)
UPDATE 2
CREATE FUNCTION
CREATE FUNCTION
INFO:  ({'date': '2005-05-05 13:20:43.793551', 'id': 4},)
ERROR:  invalid input syntax for type timestamp: "2005-05-05
13:20:43.793551"

-------


I don't think that plperl or plperlu with locales should be used in
production environment.

       Mage



pgsql-general by date:

Previous
From: "Costin Manda"
Date:
Subject: indexes on functions, then modifying functions
Next
From: "Dinesh Pandey"
Date:
Subject: can I send execution log into a file.