Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the Fishnet function as described here to create a grid.

If I use the following SQL to call the function to position a grid where I want it (I'm using NZGD2000 SRID = 2193) the query returns from postgresql as expected:

create sequence temp;

    nextval('temp')::int as id, 

If I try to create a layer in qgis using the select portion of the above SQL statement (i.e. not the create sequence command), using either 'Fast SQL Layer' or 'RT SQL Layer' plugins, the query returns zero results.

If I execute the following SQL statement in postgresql to create the temporary table and then add a PostGIS layer to qgis, the grid shows fine with all records returned as expected.

  nextval('temp')::int as id, 
  st_setsrid(geom,2193) as geom

I've used both of these plugins before for doing on-the-fly calculations in postgis and displaying in qgis - usefully eliminating the need for temporary tables. Is there a bug in them that is being triggered by this specific query? Or am I doing something wrong that I just can't see?

Using Quantum GIS 1.8.0 ; Postgresql 9.1 ; PostGIS 2.0

EDIT: clarified that I'm only running one statement in the plugin, without the create sequence command

share|improve this question
Did you make sure to specify the correct geometry column? – underdark Oct 25 '12 at 7:05
Can RT SQL run two queries together. I think not. So after "CREATE SEQUENCE temp;" it finishes. Check if you have the "temp" sequence created after getting zero results using the plugin. – Micha Oct 25 '12 at 7:11
Yes, I'm pretty certain I had the right geometry column selected. No error is returned, just a layer added, with no records within it. – Jayden Oct 25 '12 at 8:50
I do not use the 'create sequence' command in the layer sql. I have included it for completeness. – Jayden Oct 25 '12 at 8:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.