On Wed, Sep 10, 2008 at 9:45 AM, davyd <davydky@xxxxxxxxx> wrote: > Hi list, > I need to create a sql where the name of a tabla is on a variable.. > > vbuffer varchar; > > SELECT buffer > INTO vbuffer > FROM rutas r, unidades u > WHERE r.codigo_ruta = u.codigo_ruta AND > u.codigo_uni = 'B15_AFF666'; > > > SELECT within(the_geom,(SELECT geomunion(the_geom) from var vbuffer)) as > inside You'll need to do it by building the query as a string in a plpgsql function and then execute it.