Bug report #2553

QgsDataSourceURI.setSql() doesn't support LIMIT query string

Added by Giuseppe Sucameli over 10 years ago. Updated over 10 years ago.

Status:Closed
Priority:Low
Assignee:nobody -
Category:Data Provider
Affected QGIS version: Regression?:No
Operating System:Debian Easy fix?:No
Pull Request or Patch supplied: Resolution:invalid
Crashes QGIS or corrupts data: Copied to github as #:12613

Description

Trying this (in python)

uri = qgis.core.QgsDataSourceURI()
uri.setConnection(host, port, dbname, user, passwd)
uri.setDataSource(schema, table, geom_column)
uri.setSql('LIMIT 10')

vl = qgis.core.QgsVectorLayer(uri.uri(), layername, "postgres")

terminal displays this error
row number 0 is out of range 0..-1

so this query returns no rows.

History

#1 Updated by Jürgen Fischer over 10 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

Also available in: Atom PDF