The following bug has been logged on the website:
Bug reference: 12257
Logged by: Chris Goldstar
Email address: chrisgoldstar@wp.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.