Click here to Skip to main content
15,881,649 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have application in nhibernate & postgresql
migrating from sql to postgres
in postgres column type is integer but It gives error while update-insert data
C#
[Property]
    [Column(1, Name = "is_deleted", SqlType = "INTEGER")]
    public virtual bool IsDeleted
    {
        get { return isDeleted; }
        set { isDeleted = value; }
    }

Npgsql.NpgsqlException: column "is_deleted" is of type integer but expression is of type boolean Severity: ERROR Code: 42804

I have try to map column type in app.config file but not working...
XML
<property name="query.substitutions">
       true 1, false 0
     </property>


suggest a way to solve this Map column types boolean to integer...
Posted
Updated 18-Mar-13 19:24pm
v2

1 solution

Purely a guess as I don't know the technology, but have you tried setting the SQLType as bit even though the real column is int?
 
Share this answer
 
Comments
Aarti Meswania 19-Mar-13 1:35am    
are you talking to set column type bit in postgres?
_Maxxx_ 19-Mar-13 5:06am    
sorry - I think it's boolean in Postgres? so yes, I'm suggesting you see what happens if you tell the code it's a boolean even thought he column type is an integer.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900