Bug report #14363

Qgis DB Manager runs, but cannot export

Added by baditaflorin - over 4 years ago. Updated almost 3 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Unknown
Affected QGIS version:2.12.2 Regression?:No
Operating System:windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:22346

Description

When i try to execute this code in Qgis DB Manager, it works https://github.com/baditaflorin/osm-postgis-scripts/blob/test/nodes_grid_counter.sql

But if i want to create a view, or load as new layer, then i get a error

syntax error at or near "CREATE"
LINE 22: CREATE OR REPLACE FUNCTION public.makegrid_2d (

I have ilustated the process in this youtube video, so you can see better https://www.youtube.com/watch?v=mFH2NOnxezk

^

History

#1 Updated by Giovanni Manghi over 4 years ago

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

you can run arbitrary sql statements in the sql window of db manager, but when it comes to the "load as new layer" functionality you really must just run a select statement.

#2 Updated by baditaflorin - over 4 years ago

Can you please point me to why this is happening?

Can I circumvent this somehow?

I want to create something simple, and if I require first the user to do step 1, and then load another script, paste it into the DB manager, will be more complicated.

#3 Updated by Giovanni Manghi about 4 years ago

baditaflorin - wrote:

Can you please point me to why this is happening?

Can I circumvent this somehow?

I want to create something simple, and if I require first the user to do step 1, and then load another script, paste it into the DB manager, will be more complicated.

There is nothing to circumvent or fix here, in my opinion. The "load as new layer" work that way: you run a SELECT query that returns a table, and then you can use this functionality to load it into the project. If you need more SQL code in the DB Manager SQL panel, just select the part of it that is about the SELECT statement, and run just it.

#4 Updated by Jürgen Fischer almost 3 years ago

  • Category set to Unknown

Also available in: Atom PDF