Skip to content
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

Virtual layers SQL output fields without alias raise errors #24328

Closed
qgib opened this issue Apr 6, 2017 · 3 comments
Closed

Virtual layers SQL output fields without alias raise errors #24328

qgib opened this issue Apr 6, 2017 · 3 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin Feedback Waiting on the submitter for answers

Comments

@qgib
Copy link
Contributor

qgib commented Apr 6, 2017

Author Name: Giovanni Allegri (@giohappy)
Original Redmine Issue: 16419
Affected QGIS version: master
Redmine category:db_manager


Calculated fields inside Virtual Layers SQL queries (through DB Manager) must have an alias otherwise it raises errors.
The problem is that it can't be deduced from the error message.

As an example:
@
SELECT
ST_Area("landcover"."geometry")
FROM "landcover"@

will raise the message "Query preparation error on SELECT "ST_Area("comuni"."geometry")" FROM _tview LIMIT 1: near ""."": syntax error"

(you can see it in the vlayer.png image attachment)

The query works fine if an alias is added:

@select
ST_Area("landcover"."geometry") AS area
FROM "landcover"@

I guess that the fix could be to use the field function as a string and use it for the output field name (as DBs do)


@qgib
Copy link
Contributor Author

qgib commented Apr 30, 2017

Author Name: Giovanni Manghi (@gioman)


  • easy_fix was configured as 0
  • regression was configured as 0

@qgib
Copy link
Contributor Author

qgib commented Mar 9, 2019

Author Name: Giovanni Manghi (@gioman)


Please check if this issue is still valid on QGIS 3.4.5 or 3.6.


  • status_id was changed from Open to Feedback

@qgib qgib added Feedback Waiting on the submitter for answers Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin labels May 25, 2019
@gioman
Copy link
Contributor

gioman commented Dec 21, 2020

Does not seems to be an issue anymore.

@gioman gioman closed this as completed Dec 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin Feedback Waiting on the submitter for answers
Projects
None yet
Development

No branches or pull requests

2 participants