Skip to content

Commit

Permalink
fix fields creation importing layers to PG
Browse files Browse the repository at this point in the history
  • Loading branch information
brushtyler committed Dec 6, 2012
1 parent 56bba06 commit 6ed8a23
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -3145,7 +3145,6 @@ bool QgsPostgresProvider::convertField( QgsField &field )
{
case QVariant::LongLong:
fieldType = "int8";
fieldSize = -1;
fieldPrec = 0;
break;

Expand All @@ -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:
Expand Down

0 comments on commit 6ed8a23

Please sign in to comment.