<div>Viva,</div><div> </div><div>Pequena correcção para PostgreSQL &gt; 8.3...penso eu.</div><div> </div><div>select row_number() over (order by col1) as id....</div><div> </div><div>ROWNUM penso que é exclusivo ORACLE.</div>
<div> </div><div>Cumps,</div><div>Fernando Ribeiro<br><br></div><div class="gmail_quote">No dia 10 de Abril de 2012 19:40, Hugo André Carvalho Poeira <span dir="ltr">&lt;<a href="mailto:hpoeira@gmail.com">hpoeira@gmail.com</a>&gt;</span> escreveu:<br>
<blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">Olá Pedro,<br><br>Faz como é indicado no link que o Giovanni te passou. Na clausula SELECT acrescenta um campo ROWNUM AS ID, tipo:<br>
<br>SELECT ROWNUM AS ID, NAME, TIPO FROM A<br><br>O campo ROWNUM vai ser a tua chave primária da view.<br>
<br>Cumps,<br>Hugo Poeira<br><br><br><br><div class="gmail_quote">2012/4/10 Pedro Soares <span dir="ltr">&lt;<a href="mailto:pedro_gara@yahoo.com.br" target="_blank">pedro_gara@yahoo.com.br</a>&gt;</span><br><blockquote style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid" class="gmail_quote">
<div><div class="h5">
olá<div>Criei as queries (das questões de ontem). e fiz três views para representar no QGIS... acontece que qd as tento adicionar no QGIS dá-me o seguinte erro:</div><div><p style="margin:0px">

The view &#39;public.exercise_4&#39; has no column suitable for use as a unique key.</p>
<p style="margin:0px"></p>
<p style="margin:0px">Qgis requires that the view has a column that can be used as a unique key. Such a column should be derived from a table column of type int4 and be a primary key, have a unique constraint on it, or be a PostgreSQL oid column. To improve performance the column should also be indexed.</p>



<p style="margin:0px"></p>
<p style="margin:0px">The view you selected has the following columns, none of which satisfy the above conditions:</p>
<p style="margin:0px">&#39;dfe_code&#39; derives from &#39;public.estudantes.dfe_code&#39; and is not suitable (type is int4 and does not have a suitable constraint)</p>


<p style="margin:0px">&#39;geom&#39; derives from &#39;public.escolas.geom&#39; and is not suitable (type is geometry and does not have a suitable constraint)</p>
<p style="margin:0px">&#39;name&#39; derives from &#39;<a href="http://public.escolas.name" target="_blank">public.escolas.name</a>&#39; and is not suitable (type is text and does not have a suitable constraint)</p>

<p style="margin:0px"><br></p><p style="margin:0px">o que está a faltar será o unique key... existe alguma forma de fazer: Create view blabla with OIDS?</p>

</div>
<br></div></div>_______________________________________________<br>
Portugal mailing list<br>
<a href="mailto:Portugal@lists.osgeo.org" target="_blank">Portugal@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/portugal" target="_blank">http://lists.osgeo.org/mailman/listinfo/portugal</a><br>
<br></blockquote></div><br>
<br>_______________________________________________<br>
Portugal mailing list<br>
<a href="mailto:Portugal@lists.osgeo.org">Portugal@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/portugal" target="_blank">http://lists.osgeo.org/mailman/listinfo/portugal</a><br>
<br></blockquote></div><br><br clear="all"><br>