BUG #12257: Cause for: Exception 0xC0000005

From: chrisgoldstar(at)wp(dot)pl
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #12257: Cause for: Exception 0xC0000005
Date: 2014-12-17 11:34:56
Message-ID: 20141217113456.1237.19157@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 12257
Logged by: Chris Goldstar
Email address: chrisgoldstar(at)wp(dot)pl
PostgreSQL version: 9.3.5
Operating system: Windows 7 64-bit Professional
Description:

My configuration
================
System: Windows 7 64-bit Professional
DB engine: Postgres 9.3.5 64-bit
Extension: oracle_fdw 1.1

I have the following foreign table (on Oracle),

create foreign table pds_pojazd
(pm bigint not null,
dv bigint not null,
av bigint not null,
pr bigint not null,
op character varying(30) not null,
wr timestamp without time zone not null,
vf timestamp without time zone not null,
vt timestamp without time zone not null,
st_numer character varying(2000) ,
st_rodzaj character varying(2000) ,
st_marka character varying(2000) ,
st_ubezp character varying(2000) ,
fk_kierpm bigint ,
st_wynik character varying(2000)
)
server pds_oracle
OPTIONS (schema 'PDS_PRD', table 'DEF_POJAZD');
alter foreign table pds_pojazd
owner to postgres;

I have written one function (for test only) as below,

CREATE OR REPLACE FUNCTION pds_vehicle(vehicle_pm bigint, vehicle_number
character varying)
RETURNS integer AS
$BODY$
declare
v_pm bigint;
begin
-- skip function parameters
select pm into v_pm from pds_pojazd where st_numer = 'RZ8193A' and pm =
av limit 1;
return v_pm;
end
$BODY$
LANGUAGE plpgsql volatile
COST 100;
ALTER FUNCTION pds_vehicle(bigint, character varying)
OWNER TO postgres;

Calling...
select pds_vehicle(1015627, 'RZ8193A'); -- call one or more times (more than
10)
Everything works fine.

but the following stops the postgres service!

CREATE OR REPLACE FUNCTION pds_vehicle(vehicle_pm bigint, vehicle_number
character varying)
RETURNS integer AS
$BODY$
declare
v_pm bigint;
begin
-- use first parameter
select pm into v_pm from pds_pojazd where st_numer = 'RZ8193A' and pm =
vehicle_pm limit 1;
return v_pm;
end
$BODY$
LANGUAGE plpgsql volatile
COST 100;
ALTER FUNCTION pds_vehicle(bigint, character varying)
OWNER TO postgres;

or

CREATE OR REPLACE FUNCTION pds_vehicle(vehicle_pm bigint, vehicle_number
character varying)
RETURNS integer AS
$BODY$
declare
v_pm bigint;
begin
-- use second parameter
select pm into v_pm from pds_pojazd where st_numer = 'RZ8193A' and pm =
vehicle_pm limit 1;
return v_pm;
end
$BODY$
LANGUAGE plpgsql volatile
COST 100;
ALTER FUNCTION pds_vehicle(bigint, character varying)
OWNER TO postgres;

or

CREATE OR REPLACE FUNCTION pds_vehicle(vehicle_pm bigint, vehicle_number
character varying)
RETURNS integer AS
$BODY$
declare
v_pm bigint;
begin
-- use both parameters
select pm into v_pm from pds_pojazd where st_numer = vehicle_number and
pm = av limit 1;
return v_pm;
end
$BODY$
LANGUAGE plpgsql volatile
COST 100;
ALTER FUNCTION pds_vehicle(bigint, character varying)
OWNER TO postgres;

or

CREATE OR REPLACE FUNCTION pds_vehicle(vehicle_pm bigint, vehicle_number
character varying)
RETURNS integer AS
$BODY$
declare
v_pm bigint;
begin
select pm into v_pm from pds_pojazd where st_numer = vehicle_number and
pm = vehicle_pm limit 1;
return v_pm;
end
$BODY$
LANGUAGE plpgsql volatile
COST 100;
ALTER FUNCTION pds_vehicle(bigint, character varying)
OWNER TO postgres;

Calling...
select pds_vehicle(1015627, 'RZ8193A'); -- call one, two, three, four and
five times works fine
but next call stops the postgres service.
After six call the postgres shows message 'connection to database your_db
lost' and error message in log is like that

Server process (PID xxxx) was terminated by exception 0xC0000005
see C include file "ntstatus.h" for a description of the hexadecimal value.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message benoit 2014-12-17 11:42:46 BUG #12258: run php file
Previous Message Aleks Dark 2014-12-16 15:34:23 Re[2]: [BUGS] BUG #12241: uninitialized value $lib_path