[Geoserver-users] Problems with postgres-views

Hi, I'm trying to use a postgres view as a feature type to geoserver. But
I'm having some problems, anybody could help me. :cry:

I'm using GeoServer 1.3.4 and PostgreSQL 8.1 in Windows XP with Service pack
2.

The featuretype works when I use the style "Green", but when I use a new
style that a did, it´s doesn't work anymore. But if I export this view to a
shapefile and use this same style, it's work with no problems.

Well, I did the folowing steps:

- I imported a shapefile in a potgres table, and the new table has a primary
key called 'gid'.
- I renamed this colunm to 'oid'.

Here is the table code :

"CREATE TABLE bairros_zpols
(
  oid int4 NOT NULL DEFAULT nextval('bairros_zpols_gid_seq'::regclass),
  codigo int8,
  nomebairro varchar,
  zpol_1 int8,
  zpol_2 int8,
  zpol_3 int8,
  the_geom geometry,
  CONSTRAINT bairros_zpols_pkey PRIMARY KEY (oid),
  CONSTRAINT enforce_dims_the_geom CHECK (ndims(the_geom) = 2),
  CONSTRAINT enforce_geotype_the_geom CHECK (geometrytype(the_geom) =
'MULTIPOLYGON'::text OR the_geom IS NULL),
  CONSTRAINT enforce_srid_the_geom CHECK (srid(the_geom) = 4326)
)
WITHOUT OIDS;"

- I used this table below to do a Join with the table above:
"CREATE TABLE teste
(
  bairro varchar,
  cidade varchar,
  data_registro date,
  local_tipo varchar,
  logradouro varchar,
  meio_empregado varchar,
  perimetro1 varchar,
  perimetro2 varchar,
  tipo_delito varchar,
  zpol int2
)
WITH OIDS;"

- Here is the view code:
CREATE OR REPLACE VIEW teste_mapa AS
SELECT bairros_zpols.oid, bairros_zpols.codigo, bairros_zpols.nomebairro,
bairros_zpols.zpol_1, bairros_zpols.zpol_2, bairros_zpols.zpol_3,
bairros_zpols.the_geom, teste.bairro, teste.qtd_ocorrencias
   FROM bairros_zpols
   LEFT JOIN ( SELECT teste.bairro, count(teste.bairro) AS qtd_ocorrencias
           FROM teste
          GROUP BY teste.bairro) teste ON bairros_zpols.nomebairro::text =
teste.bairro::text;

And he is the geoserver output:
661609 [INFO] org.vfny.geoserver.servlets.AbstractService - handling
request: o
rg.vfny.geoserver.wms.requests.GetMapRequest@anonymised.com
661625 [SEVERE]
org.geotools.renderer.lite.StreamingRenderer$DefaultRenderListe
ner - Error transforming bbox
661625 [SEVERE]
org.geotools.renderer.lite.StreamingRenderer$DefaultRenderListe
ner - Exception rendering layer DefaultMapLayer[ UNNAMED, VISIBLE,
style=StyleIm
pl<NO_PARENT>[ name=bairros_registro],
data=org.vfny.geoserver.global.GeoServerF
eatureLocking@anonymised.com]
661640 [INFO] org.vfny.geoserver.servlets.AbstractService - Service handled

As result the geoserver returns a blank imagem. :frowning:

How can I solve this problem?

Thanks in advance.