Skip to content
Permalink
Browse files
fix fields creation importing layers to PG
  • Loading branch information
brushtyler committed Dec 6, 2012
1 parent 56bba06 commit 6ed8a2349afd3029182408c4a4db3f387497bc91
Showing with 12 additions and 7 deletions.
  1. +12 −7 src/providers/postgres/qgspostgresprovider.cpp
@@ -3145,7 +3145,6 @@ bool QgsPostgresProvider::convertField( QgsField &field )
{
case QVariant::LongLong:
fieldType = "int8";
fieldSize = -1;
fieldPrec = 0;
break;

@@ -3155,22 +3154,28 @@ bool QgsPostgresProvider::convertField( QgsField &field )
break;

case QVariant::Int:
fieldType = "int";
fieldSize = -1;
if ( fieldPrec < 10 )
{
fieldType = "int4";
}
else
{
fieldType = "numeric";
}
fieldPrec = 0;
break;

case QVariant::Double:
if ( fieldSize <= 0 || fieldPrec <= 0 )
if ( fieldSize > 18 )
{
fieldType = "float";
fieldType = "numeric";
fieldSize = -1;
fieldPrec = -1;
}
else
{
fieldType = "decimal";
fieldType = "float8";
}
fieldPrec = -1;
break;

default:

0 comments on commit 6ed8a23

Please sign in to comment.