-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for quoted primary key columns in uri upon import #3599
Conversation
Still needs further testing (including automated) and since we're at it I could add support for importing layers with multi-column primary keys |
for ( int fldIdx = 0; fldIdx < fields.count(); ++fldIdx ) | ||
QStringList cols = parseUriKey(primaryKey); | ||
if ( cols.size() > 1 ) { | ||
QgsMessageLog::logMessage( tr( "crateEmptyLayer does not support composite keys yet" ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/crateEmptyLayer/createEmptyLayer/
@@ -119,6 +119,11 @@ class QgsPostgresProvider : public QgsVectorDataProvider | |||
static QString endianString(); | |||
|
|||
/** | |||
* Returns a lits of unquoted column names from an uri key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/lits/list/
Typo fixed and the "unsupported multi-column key" message removed as with new commits we now support that ! I've tried with multi-column key, a FidMapped (string) key and a view, plus a normal table. If I understood correctly these URI keys end up in project files, so we can't just change semantic w/out breaking backward compatibility ? |
Fixes qgis#15226 (drag & drop of postgresql views)
8a0f486
to
79b30a2
Compare
I've now also added a test, but I still don't like to see those quoted identifiers in the QgsDatasourceUri.key parameter. It's good to support them for backward compatibility, but going forward I think we should avoid the quotes in the URI. @jef-n how about reverting daa6510 and deal with that bug on the reading side ? |
@jef-n I have just tested, and reverting daa6510 does not reintroduce the bug in http://hub.qgis.org/issues/13710 -- clean URI with no quotes are better, aren't them ? I'll push another commit to that extent |
This reverts commit daa6510. I've tested that reverting this does not re-introduce bug http://hub.qgis.org/issues/13710
See http://hub.qgis.org/issues/15226