SCM

[#1011161] Bug in NpgsqlCommand while getting readers from refcursors

View Trackers | Bugs | Download .csv | Monitor

Date:
2012-02-17 05:21
Priority:
3
State:
Open
Submitted by:
Rabin Karki (arke)
Assigned to:
Nobody (None)
Npgsql Version:
None
Category:
Group:
Resolution:
None
Summary:
Bug in NpgsqlCommand while getting readers from refcursors

Detailed description
When I call NpgsqlCommand.ExecuteReader(), and my PostgreSQL function returns cursor(s), subsequently "fetch all from <cursor name>" queries will be issued to read data from cursors.

But the problem is if one of the "fetch all" queries takes longer than 20 seconds (unfortunately I have one of them), Npgsql will throw a Timeout exception. There is no way to set this timeout behavior -- it's always set to 20 seconds (default). I think at least the "fetch all" commands should utilize the NpgsqlCommand.CommandTimeout value set by users.

To do that it's a simple one line fix.
On NpgsqlCommand.cs, line 626, this line:

reader = new NpgsqlCommand(sb.ToString(), Connection).GetReader(reader._behavior);

should be replaced with:

var c = new NpgsqlCommand(sb.ToString(), Connection);
c.CommandTimeout = this.CommandTimeout;
reader = c.GetReader(reader._behavior);

Followup

Message
Date: 2012-03-23 12:46
Sender: Francisco Figueiredo jr.

Fixed in cvs.

Please, give it a try and let me know if it works for you ok.

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge