Bug report #9139

Relations do not work on MSSQL layers

Added by Tudor Bărăscu about 11 years ago. Updated over 10 years ago.

Status:Closed
Priority:Normal
Assignee:Nathan Woodrow
Category:Data Provider/MSSQL
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:17774

Description

I have tested relations (http://blog.vitu.ch/10112013-1201/qgis-relations) with postgis, sqlite, shapefiles and MSSQL layers. The relations using MSSQL Server tables don't work. I tested having a child table from SQL Server 2005 and 2012, both express editions. The functionality of assigning children seems to work, but when clicking on the parent feature it doesn't show any children (although they exist).

Associated revisions

Revision 9e67d7a6
Added by Nathan Woodrow over 10 years ago

Fix #9139 - Don't crash on MSSQL relations

History

#1 Updated by Matthias Kuhn about 11 years ago

  • Affected QGIS version changed from 2.0.1 to master

What type do the foreign key / primary key columns have?

#2 Updated by Matthias Kuhn about 11 years ago

  • Status changed from Open to Feedback

#3 Updated by Tudor Bărăscu about 11 years ago

The foreign key/primary key columns have integer type.

Parent table: postgis vector layer from (id serial PKEY, ...)

Newly created child table from sql server (id integer PKEY, id_master integer, ...).

The if_master column in the child references id column in the parent table.
All the best,

#4 Updated by Matthias Kuhn about 11 years ago

Can you open a form with embedded table and check the output (on a terminal. I think on windows you will have to use DebugView? [1] ) for a line like this:

src/core/qgsrelation.cpp: 177: (getRelatedFeaturesRequest) Filter conditions: '"base" = 4'

the part "base" = 4 will of course be different for you

[1] http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

#5 Updated by Tudor Bărăscu about 11 years ago

Hi Matthias,

Thank you for your quick reply.

Please find bellow the capture.

[6188] ..\\..\\..\\..\\..\\src\\core\\qgsrelation.cpp(177) : (QgsRelation::getRelatedFeaturesRequest) Filter conditions: '"FID_MASTER" = 20'
[6188] ..\\..\\..\\..\\..\\src\\gui\\attributetable\\qgsattributetablemodel.cpp(39) : (QgsAttributeTableModel::QgsAttributeTableModel) entered.
[6188] ..\\..\\..\\..\\..\\src\\gui\\attributetable\\qgsattributetablemodel.cpp(332) : (QgsAttributeTableModel::loadLayer) entered.
[6188] ..\\..\\..\\..\\..\\..\\src\\providers\\mssql\\qgsmssqlfeatureiterator.cpp(251) : (QgsMssqlFeatureIterator::rewind) [Microsoft][ODBC SQL Server Driver][SQL Server]An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name. [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near '.'. QODBC3: Unable to execute statement
[6188] ..\\..\\..\\..\\..\\..\\src\\providers\\mssql\\qgsmssqlfeatureiterator.cpp(198) : (QgsMssqlFeatureIterator::fetchFeature) Read attempt on inactive query
[6188] ..\\..\\..\\..\\..\\..\\src\\providers\\mssql\\qgsmssqlfeatureiterator.cpp(267) : (QgsMssqlFeatureIterator::close) QgsMssqlFeatureIterator::close on inactive query
[6188] ..\\..\\..\\..\\..\\src\\gui\\qgscollapsiblegroupbox.cpp(112) : (QgsCollapsibleGroupBoxBasic::showEvent) found a QScrollArea parent:
[6188] ..\\..\\..\\..\\..\\src\\gui\\qgscollapsiblegroupbox.cpp(373) : (QgsCollapsibleGroupBoxBasic::updateStyle) groupbox: QgsRelationEditorWidgetBase style: plastique offset: left=0 top=2 top2=1

Regards,
Tudor

#6 Updated by Matthias Kuhn about 11 years ago

  • Category changed from Browser to Data Provider/MSSQL
  • Assignee changed from Matthias Kuhn to Tamas Szekeres

It looks like a MSSQL provider issue. I don't have an MSSQL server to experiment with. Let's hope somebody with this possibility steps in.

#7 Updated by Nathan Woodrow over 10 years ago

  • Assignee changed from Tamas Szekeres to Nathan Woodrow

I will have a look into this.

#8 Updated by Anonymous over 10 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF