Skip to content

Commit 6dece23

Browse files
author
jef
committedDec 8, 2009
include key= field in all postgres data source uris (only for views before)
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12369 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent a5801be commit 6dece23

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed
 

‎src/providers/postgres/qgspostgresprovider.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
159159
if ( mCurrentSchema == mSchemaName )
160160
{
161161
mUri.clearSchema();
162-
setDataSourceUri( mUri.uri() );
163162
}
163+
164164
if ( mSchemaName == "" )
165165
mSchemaName = mCurrentSchema;
166166

@@ -250,6 +250,11 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
250250
{
251251
valid = false;
252252
}
253+
else
254+
{
255+
mUri.setKeyColumn( primaryKey );
256+
setDataSourceUri( mUri.uri() );
257+
}
253258

254259
// Close the database connection if the layer isn't going to be loaded.
255260
if ( !valid )
@@ -1097,9 +1102,6 @@ QString QgsPostgresProvider::getPrimaryKey()
10971102
// From the view columns, choose one for which the underlying
10981103
// column is suitable for use as a key into the view.
10991104
primaryKey = chooseViewColumn( cols );
1100-
1101-
mUri.setKeyColumn( primaryKey );
1102-
setDataSourceUri( mUri.uri() );
11031105
}
11041106
}
11051107
else
@@ -3159,9 +3161,6 @@ QString QgsPostgresProvider::description() const
31593161
return POSTGRES_DESCRIPTION;
31603162
} // QgsPostgresProvider::description()
31613163

3162-
3163-
3164-
31653164
/**
31663165
* Class factory to return a pointer to a newly created
31673166
* QgsPostgresProvider object

0 commit comments

Comments
 (0)
Please sign in to comment.