PgSqlCommand only uses first entry in search path

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
tobievandyk
Posts: 1
Joined: Fri 27 Nov 2015 09:56

PgSqlCommand only uses first entry in search path

Post by tobievandyk » Fri 27 Nov 2015 10:04

When I set my search path to 'usr, public' then PgSqlCommand for CommandType.StoredProcedure only searches the usr schema and does not find any functions in the public schema.

Has this bug been fixed? I am using 7.3.333.0.

Pinturiccio
Devart Team
Posts: 2420
Joined: Wed 02 Nov 2011 09:44

Re: PgSqlCommand only uses first entry in search path

Post by Pinturiccio » Mon 30 Nov 2015 15:39

We could not reproduce the issue. In our environment it works both with 7.3.333 and with the latest version of dotConnect for PostgreSQL. We have created a simple example. This example connects to the test1 schema. Then we set search_path for schemas test and public. The test1 function exists only in the schema public.

The DDL script of the test1 function:

Code: Select all

CREATE OR REPLACE FUNCTION test1()
  RETURNS integer AS
$BODY$
    begin
    return 10;
    end;$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100;
ALTER FUNCTION test1() OWNER TO postgres;
C# code:

Code: Select all

PgSqlConnection conn = new PgSqlConnection("Host=<HOST>;port=5434;User Id=postgres;pwd=<PASSWORD>;schema=test1;");
conn.Open();
PgSqlCommand comm = new PgSqlCommand("SET search_path TO test, public", conn);
comm.ExecuteNonQuery();
comm = new PgSqlCommand("test1", conn);
comm.CommandType = System.Data.CommandType.StoredProcedure;
comm.Parameters.Add("return_value", PgSqlType.Int).Direction = System.Data.ParameterDirection.ReturnValue;
comm.ExecuteNonQuery();
Console.WriteLine(comm.Parameters[0].Value);
conn.Close();
Please tell us what changes we need to make to this example in order to reproduce the issue.

Post Reply