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 6464 <PackageReference Include =" NUnit3TestAdapter" Version =" 3.13.0" />
6565 <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 16.1.1" />
6666 <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 " />
6868 </ItemGroup >
6969 <ItemGroup Condition =" $(NhNetFx)" >
7070 <Reference Include =" System.Configuration" />
Original file line number Diff line number Diff line change @@ -138,7 +138,43 @@ public PostgreSQLColumnMetadata(DataRow rs)
138138 this . SetNumericalPrecision ( rs [ "NUMERIC_PRECISION" ] ) ;
139139
140140 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 ;
142178 }
143179 }
144180
You can’t perform that action at this time.
0 commit comments