Skip to content
Permalink
Browse files

[postgres] some more precision/length fixes

  • Loading branch information
m-kuhn committed Aug 29, 2013
1 parent a9c05d7 commit 8c4c57b1545ce0503552b7c66a1cf9c22cc3e51e
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/providers/postgres/qgspostgresprovider.cpp
@@ -168,8 +168,8 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
<< QgsVectorDataProvider::NativeType( tr( "Decimal number (double)" ), "double precision", QVariant::Double, -1, -1, -1, -1 )

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

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

0 comments on commit 8c4c57b

Please sign in to comment.
You can’t perform that action at this time.