Skip to content

Commit

Permalink
[postgres] some more precision/length fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 29, 2013
1 parent a9c05d7 commit 8c4c57b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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() );
}

Expand Down

0 comments on commit 8c4c57b

Please sign in to comment.