RC2 intermittent errors - Mailing list pgsql-hackers

From Gaetano Mendola
Subject RC2 intermittent errors
Date
Msg-id cq9k0e$rja$1@floppy.pyrenet.fr
Whole thread Raw
Responses Re: RC2 intermittent errors
List pgsql-hackers
Hi all,
I'm testing now RC2 against our application and I'm experiencing
intermittent errors. I isolated this test:


CREATE TABLE users (id_login SERIAL PRIMARY KEY,        login TEXT
);


CREATE OR REPLACE FUNCTION sp_id_user ( TEXT  )
RETURNS INTEGER AS $$
DECLARE    a_login ALIAS FOR $1;    my_id INTEGER;
BEGIN    SELECT id_login INTO my_id    FROM users    WHERE login = a_login;
    RETURN COALESCE(my_id, -1 );

END;
$$ LANGUAGE 'plpgsql'
STABLE;

CREATE OR REPLACE FUNCTION sp_test ( TEXT  )
RETURNS INTEGER AS $$
DECLARE    a_login ALIAS FOR $1;    my_id INTEGER;
BEGIN        my_id = sp_id_user( a_login );        RAISE NOTICE 'ID> %', my_id;
        insert into users (login) values ( a_login );
        my_id = sp_id_user( a_login );        RAISE NOTICE 'ID> %', my_id;
        RETURN 0;
END;
$$ LANGUAGE 'plpgsql';

select sp_test('test1');
select sp_test('test2');


The call of the two above functions shall show:

ID> -1
ID> 1

ID> -1
ID> 2


instead I have:

test=# select sp_test('test1');
NOTICE:  ID> -1
NOTICE:  ID> 1 sp_test
---------       0
(1 row)

test=# select sp_test('test2');
NOTICE:  ID> -1
NOTICE:  ID> -1 sp_test
---------       0
(1 row)


some times I get:

test=# select sp_test('test1');
NOTICE:  ID> -1
NOTICE:  ID> -1 sp_test
---------       0
(1 row)

test=# select sp_test('test2');
NOTICE:  ID> -1
NOTICE:  ID> -1 sp_test
---------       0
(1 row)






Regards
Gaetano Mendola

































pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bgwriter behavior
Next
From: Tom Lane
Date:
Subject: Re: RC2 intermittent errors