Skip to content

Commit 8c4c57b

Browse files
committedAug 29, 2013
[postgres] some more precision/length fixes
1 parent a9c05d7 commit 8c4c57b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
168168
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double, -1, -1, -1, -1 )
169169

170170
// string types
171-
<< QgsVectorDataProvider::NativeType( tr( "Text, fixed length (char)" ), "char", QVariant::String, 1, 255 )
172-
<< QgsVectorDataProvider::NativeType( tr( "Text, limited variable length (varchar)" ), "varchar", QVariant::String, 1, 255 )
171+
<< QgsVectorDataProvider::NativeType( tr( "Text, fixed length (char)" ), "char", QVariant::String, 1, 255, -1, -1 )
172+
<< QgsVectorDataProvider::NativeType( tr( "Text, limited variable length (varchar)" ), "varchar", QVariant::String, 1, 255, -1, -1 )
173173
<< QgsVectorDataProvider::NativeType( tr( "Text, unlimited length (text)" ), "text", QVariant::String, -1, -1, -1, -1 )
174174

175175
// date type
@@ -1872,7 +1872,7 @@ bool QgsPostgresProvider::addAttributes( const QList<QgsField> &attributes )
18721872
}
18731873
else if ( type == "numeric" || type == "decimal" )
18741874
{
1875-
if ( iter->length() > 0 && iter->precision() > 0 )
1875+
if ( iter->length() > 0 && iter->precision() >= 0 )
18761876
type = QString( "%1(%2,%3)" ).arg( type ).arg( iter->length() ).arg( iter->precision() );
18771877
}
18781878

0 commit comments

Comments
 (0)
Please sign in to comment.