File tree Expand file tree Collapse file tree 2 files changed +38
-2
lines changed
NHibernate/Dialect/Schema Expand file tree Collapse file tree 2 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 64
64
<PackageReference Include =" NUnit3TestAdapter" Version =" 3.13.0" />
65
65
<PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 16.1.1" />
66
66
<PackageReference Include =" FirebirdSql.Data.FirebirdClient" Version =" 6.6.0" />
67
- <PackageReference Include =" Npgsql" Version =" 4 .0.3 " />
67
+ <PackageReference Include =" Npgsql" Version =" 5 .0.11 " />
68
68
</ItemGroup >
69
69
<ItemGroup Condition =" $(NhNetFx)" >
70
70
<Reference Include =" System.Configuration" />
Original file line number Diff line number Diff line change @@ -138,7 +138,43 @@ public PostgreSQLColumnMetadata(DataRow rs)
138
138
this . SetNumericalPrecision ( rs [ "NUMERIC_PRECISION" ] ) ;
139
139
140
140
Nullable = Convert . ToString ( rs [ "IS_NULLABLE" ] ) ;
141
- TypeName = Convert . ToString ( rs [ "DATA_TYPE" ] ) ;
141
+ TypeName = NormalizeTypeNames ( Convert . ToString ( rs [ "DATA_TYPE" ] ) ) ;
142
+ }
143
+
144
+ private static string NormalizeTypeNames ( string typeName )
145
+ {
146
+ switch ( typeName )
147
+ {
148
+ case "double precision" :
149
+ return "float8" ;
150
+ case "real" :
151
+ return "float4" ;
152
+ case "smallint" :
153
+ return "int2" ;
154
+ case "integer" :
155
+ return "int4" ;
156
+ case "bigint" :
157
+ return "int8" ;
158
+ }
159
+
160
+ if ( typeName . StartsWith ( "character" , StringComparison . Ordinal ) )
161
+ {
162
+ return typeName . Replace ( "character varying" , "varchar" ) . Replace ( "character" , "char" ) ;
163
+ }
164
+
165
+ if ( typeName . EndsWith ( " with time zone" , StringComparison . Ordinal ) )
166
+ {
167
+ return typeName . StartsWith ( "timestamp" , StringComparison . Ordinal )
168
+ ? typeName . Replace ( " with time zone" , string . Empty ) . Replace ( "timestamp" , "timestamptz" )
169
+ : typeName . Replace ( " with time zone" , string . Empty ) . Replace ( "time" , "timetz" ) ;
170
+ }
171
+
172
+ if ( typeName . EndsWith ( " without time zone" , StringComparison . Ordinal ) )
173
+ {
174
+ return typeName . Replace ( " without time zone" , string . Empty ) ;
175
+ }
176
+
177
+ return typeName ;
142
178
}
143
179
}
144
180
You can’t perform that action at this time.
0 commit comments