Bug report #20607

MSsql Invalid layer

Added by Zannis Kostalas about 1 year ago. Updated about 1 year ago.

Status:Open
Priority:High
Assignee:-
Category:Data Provider/MSSQL
Affected QGIS version:3.4.1 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28427

Description

The case:
On the same server, created an exact copy of a polygon table on a different db
SELECT * INTO db2.dbo.geom_table_copy FROM db1.dbo.geom_table

While QGIS was reading the original table normally, when attempting to insert the copied table I would get
"WARNING dbname='db2' host=www.myhost.com user='user' password='pwd' srid=4326 type=Polygon disableInvalidGeometryHandling='0' table="dbo"."geom_table_copy" (POLYGON) sql= is an invalid layer - not loaded"

The problem got solved when I populated the "sql" field on the table selection with a random, valid query, loaded the table and then deleted the query. As it seems, for some reason, when creating the connection to the 2nd db, that field, enev though appearing blank, was populated in the background with an invalid expression (that's my best guess at least)

Once you know how to fix it it's easy but this was bugging me for close to 6 months now and no solution exists on the internet

History

#1 Updated by Giovanni Manghi about 1 year ago

  • Status changed from Open to Feedback

Does it works as expected on 2.18?

#2 Updated by Zannis Kostalas about 1 year ago

Giovanni Manghi wrote:

Does it works as expected on 2.18?

QGIS 2.18.15 loads the layers properly

#3 Updated by Giovanni Manghi about 1 year ago

  • Regression? changed from No to Yes
  • Priority changed from Normal to High
  • Status changed from Feedback to Open

Also available in: Atom PDF