As from ms sql to call the c function parameters, which is prilichnom postgresql?

need to call a simple function and get the result.
create or replace function fn_order_exist(p_order_ms_id int)
returns int
language plpgsql
 if exists (select 1 from public.orders where order_ms_id=p_order_ms_id) then
 return 1;
 return 0;
 end if; 

OPENQUERY does not understand the parameters.
request to the table can't do
select order_id from pgServer.aac.[public].orders where order_id=1;
TK 2000 and mssql driver does not understand some types of data falling down with errors like:
Server: Msg 7356, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' supplied inconsistent metadata for a column. Metadata information was changed at execution time.
OLE DB error trace [Non-interface error: Column 'self_order' (compile-time ordinal 7) of object '"aac"."public"."orders"' was reported to have a DBCOLUMNFLAGS_ISLONG of 128 at compile time and 0 at run time].

March 23rd 20 at 19:11
1 answer
March 23rd 20 at 19:13
>OPENQUERY does not understand the parameters.
Understands everything, just build the query using dynamic sql i.e. collecting pre-text query, and then perform it.

Something like this:
declare @sql varchar(max)
set @sql = concat('OPENQUERY ...."",@var1,"" somesql"",@var2,""'..."')
exec (@sql)

Find more questions by tags SQL ServerPostgreSQL