RC2 intermittent errors

From: Gaetano Mendola <mendola(at)bigfoot(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: RC2 intermittent errors
Date: 2004-12-21 16:46:09
Message-ID: cq9k0e$rja$1@floppy.pyrenet.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-12-21 17:13:14 Re: RC2 intermittent errors
Previous Message Tom Lane 2004-12-21 15:44:48 Re: Bgwriter behavior