Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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
[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...
<property name="query.substitutions">
       true 1, false 0
     </property>
 
suggest a way to solve this Map column types boolean to integer...
Posted 18-Mar-13 20:23pm
Edited 18-Mar-13 20:24pm
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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?
  Permalink  
Comments
Aarti Meswania at 19-Mar-13 1:35am
   
are you talking to set column type bit in postgres?
_Maxxx_ at 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)

  Print Answers RSS
0 George Jonsson 175
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 19 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100