SCM

[#1011191] Unexpected behaviour of AllowDbNull property on Outer Join queries

View Trackers | Bugs | Download .csv | Monitor

Date:
2012-05-02 13:46
Priority:
3
State:
Open
Submitted by:
Daniele Cappellani (danielec)
Assigned to:
Nobody (None)
Npgsql Version:
2.0.10
Category:
Group:
Resolution:
None
Summary:
Unexpected behaviour of AllowDbNull property on Outer Join queries

Detailed description
Hello everyone, first of all.

When I query two pgsql related tables in left join, if one of the selected columns of the second table doesn't accept null values and the referenced column is not always present in the first table, so that query result can have NULL values for that column, NpgsqlDataAdapter.FillSchema set property AllowDbNull of the DataColumn of the second table at TRUE in the DataTable, throwing an exception of violated null constraint.


Detailed description of the problem:

Entry conditions:
* Names table with these columns:
id_names - bigserial
name - varchar

* Addresses table with these columns:
id_addresses - bigserial
address - varchar - NOT NULL (very important!)
name_names - varchar

* Tables are filled like this:
Names:
id_names - name
1 - John
2 - Jack

Addresses
id_addresses - address - name_names
1 - Road One - John
2 - Road Two - John

* Select command:
SELECT * FROM Names LEFT JOIN Addresses ON Names.name = Addresses.name_names

Expected Output:
* Query Result in DataTable with Schema filled:
id_names - name - id_addresses - address - name_names
1 - John - 1 - Road One - John
1 - John - 2 - Road Two - John
2 - Jack - NULL - NULL - NULL

Actual Output:
Exception
"Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints."

DataTable.GetErrors contains "address" column as in-error-state column.

I hope it is clear enough, thank you all.

Followup

Message
Date: 2012-05-07 00:18
Sender: Francisco Figueiredo jr.

Hi, Daniele!

It seems to be a problem with Npgsql regarding metadata handling. I need to check this problem better.

Unfortunately I'll go out in a vacation for the next two weeks. I'll be back on May 25 and I go back to this problem as soon as I get back.

Thanks for your report and sorry for this inconvenience. :(
Date: 2012-05-03 14:20
Sender: Francisco Figueiredo jr.


Thank you for your report. It is very clear.

I'll check the problem and find a solution.

Attached Files:

Changes:

No Changes Have Been Made to This Item

Powered By FusionForge