Question: Is there any way to create common PostGIS views (e.g. buffers, intersections, differences) by using script-created dialog boxes. A GUI for doing spatial analysis based on PostGIS would be quite helpful for users with no SQL skills.

Example 'Buffer':

[![enter image description here](https://i.stack.imgur.com/z41e2.png)](https://i.stack.imgur.com/z41e2.png)

[![enter image description here](https://i.stack.imgur.com/U20kS.png)](https://i.stack.imgur.com/U20kS.png)

```
CREATE VIEW test_schema.buffer_bus_stops AS
SELECT
    row_number() over() AS gid,
    ST_Buffer(geom, 100)::geometry(Polygon, /*SRID*/) AS geom
FROM test_schema.bus_stops;

```

Answer: 
You can run any SQL on a connected database. Create a script:

```
##Run SQL=name
##dbname=string 
##mysql=string 
outputs_QGISPOSTGISEXECUTESQL_1=processing.runalg('qgis:postgisexecutesql', dbname,mysql)

```

When run, this will give you a dialogue box where you can add the database name and the SQL statement. 

![](https://i.stack.imgur.com/bim8N.png)
I am not sure if you want to achieve this without writing code, but if you want to create a Python script to create views in PostgreSQL/PostGIS by using drop-down menus for pre-programmed SQL, you could use the Python library psycopg2. You could use python variables as table names, etc. 

Take a look at the docs here: <http://initd.org/psycopg/docs/>

Then you could create a plugin for QGIS, use a custom designed form (using QT Designer) in which the user chooses some parameters.