SCM

[#1010802] NpgsqlCommand.ExecuteScalar() method doesn't read CompletedResponse backend message

View Trackers | Bugs | Download .csv | Monitor

Date:
2010-05-03 10:15
Priority:
3
State:
Open
Submitted by:
Jacek KaƂucki (jacekk)
Assigned to:
Nobody (None)
Npgsql Version:
2.0.8
Category:
Group:
Resolution:
None
Summary:
NpgsqlCommand.ExecuteScalar() method doesn't read CompletedResponse backend message

Detailed description
I found that the following code raises System.InvalidCastException exception:

string sql1 = "select * from table a";
string sql2 = "select * from table b";
NpgsqlDataAdapter da1 = new NpgsqlDataAdapter(sql1, connection);
da1.FillSchema(dataSet, SchemaType.Source, tableAlias1);
NpgsqlDataAdapter da2 = new NpgsqlDataAdapter(sql2, connection);
da2.FillSchema(dataSet, SchemaType.Source, tableAlias2); // <- Exception is raised here.

After My further investigation, I discovered that ExecuteScalar() method, that is called by NpgsqlConnector.IsValid(), it reads from input stream only backend response row, but not CompletedResponse message that follows, which remains unread in buffer.
As result, GetTablesFromOids() fails to read correct responses from input stream.

Followup

Message
Date: 2010-05-23 19:36
Sender: Francisco Figueiredo jr.


Hi!

I tried your sample code and it didn't throw an exception.

Would you mind to send a complete sample which reproduces this problem?

Thanks in advance.

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge