[Mono-bugs] [Bug 58163][Maj] Changed - Null values in Postgres DB don't evaluate to null
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Tue, 11 May 2004 15:27:15 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by agillesp@vt.edu.
http://bugzilla.ximian.com/show_bug.cgi?id=58163
--- shadow/58163 2004-05-11 14:58:33.000000000 -0400
+++ shadow/58163.tmp.24730 2004-05-11 15:27:15.000000000 -0400
@@ -68,6 +68,48 @@
Or it might return when we try data fill under Npgsql (Though it
sounds like DataRow problem, and it did not vary even if I explicitly
let null (not DBNull.Value) to "col2" above.
Can you provide us a reproducable code?
+
+------- Additional Comments From agillesp@vt.edu 2004-05-11 15:27 -------
+The example you provided has nothing to do with with a PostgreSQL
+database and is not using Npgsql.dll. Now I know Mono is not the
+maintainer of Npgsql, but because things work fine in Windows, it
+seems Mono - not Npgsql - is the culprit.
+
+I'm thinking more of something like (note - I haven't compiled this
+code so it may not work right away):
+
+using System;
+using System.Data;
+using Npgsql;
+
+public class MyClass
+{
+ public static void Main()
+ {
+ // Given - A PostgeSQL table named "null_table" with a varchar
+ // column named "null_col" where the first record is null.
+
+ NpgsqlConnection con = new NpgsqlConnection("connection_string");
+ con.Open();
+
+ string sql = "SELECT null_col FROM null_table";
+ NpgsqlCommand cmd = new NpgsqlCommand(sql, con);
+
+ NpgsqlDataReader dr = cmd.ExecuteReader();
+ if (dr.Read())
+ {
+ IDataRecord rec = (IDataRecord)dr;
+ string val = (string)rec["null_col"];
+ if (val == null)
+ Console.WriteLine("The field evaluated to null - that's surprising.");
+ else
+ Console.WriteLine("The field evaluated to NOT null - this is
+expected but incorrect.");
+ }
+ }
+}
+
+I think that will give you what I'm seeing.