Page 1 of 1

Can't import Postgres stored procedure

Posted: Mon 10 Jan 2011 13:19
by rgillingham
Hi

This applied to Devart and MS Entity models. Why can't I import a stored procedure with the following DDL? It means I have to use Linq or ADO.net to dispatch these.

Thanks

Richard

CREATE OR REPLACE FUNCTION "vhn_external"."public_live_location_list" (
out "location_short_id" char,
out "address_name" varchar,
out "location_type" varchar,
out "line_1" varchar,
out "line_2" varchar,
out "line_3" varchar,
out "town" varchar,
out "county" varchar,
out "postcode" varchar,
out "country_code" varchar,
out "weekday_start" time,
out "weekday_end" time,
out "saturday_open" boolean,
out "saturday_start" time,
out "saturday_end" time,
out "sunday_open" boolean,
out "sunday_start" time,
out "sunday_end" time,
out "email" varchar,
out "phone" varchar
)
RETURNS SETOF record AS
$body$
BEGIN
RETURN QUERY
SELECT etc etc
END;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER
COST 100 ROWS 1000;

Posted: Tue 11 Jan 2011 15:42
by AndreyR
Could you please specify the exact error message and your steps before encountering the error?

Posted: Tue 11 Jan 2011 18:48
by rgillingham
It's simple to create

Try and drop the stored procedure onto the design surface

For Entity Framework (EDMX) and we get a message saying that we cannot import a composable function

For Entity Developer (EDML) (postgres) and I get

"Cannot create model object for 'public_location_list'. Cannot create method for storage function 'public_location_list' that can be composed. Only stored procedures may be mapped.

Richard

Posted: Wed 12 Jan 2011 10:11
by AndreyR
Take a look at the workaround I have provided in this post.
Please let us know if anything goes wrong.