<div dir="ltr">Dear users,<div><br></div><div>I have run a SQL Select [1] in order to Dissolve the features in a PostGIS table using ST_Union. I can load the Select [1] result as a new layer in QGIS, but when I try to create a PostgreSQL View [2] for the Select [1], I get an error message: [ERROR: cannot change name of view column "geom" to "id". Would anyone give me a hint or direction to solve this problem?</div><div><br></div><div>[1]</div><div><div><br></div><div>--CREATE OR REPLACE VIEW geointeligencia.vw_cpma_limites AS<br>(<br>SELECT <br>row_number() over() AS id, <br>st_union(mue_cpma.geom)::geometry(MultiPolygon,4674) as geom<br>FROM( <br>SELECT *<br>FROM geo.br_municipios_2021 <br>WHERE <br>NM_MUN IN (<br>'Afonso Cunha',<br>'Água Doce do Maranhão',<br>'Alcântara',<br>'Aldeias Altas',<br>'Altamira do Maranhão'<br>)<br>AND <br>SIGLA IN('MA')) AS mue_cpma<br>);<br></div><div><br></div><div>[2]</div><div>CREATE OR REPLACE VIEW geointeligencia.vw_cpma_limites AS<br>(<br>SELECT <br>row_number() over() AS id, <br>st_union(mue_cpma.geom)::geometry(MultiPolygon,4674) as geom<br>FROM( <br>SELECT *<br>FROM geo.br_municipios_2021 <br>WHERE <br>NM_MUN IN (<br>'Afonso Cunha',<br>'Água Doce do Maranhão',<br>'Alcântara',<br>'Aldeias Altas',<br>'Altamira do Maranhão'<br>)<br>AND <br>SIGLA IN('MA')) AS mue_cpma  <br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><font face="verdana, sans-serif">##########################################</font></div><font size="4" face="verdana, sans-serif"><b><font color="#20124d">Julierme G Pinheiro</font></b><br><b><font color="#660000">SDI Expert & Geoprocessing Specialist</font></b></font><div><font size="4" face="verdana, sans-serif"><font color="#351c75">Phone:</font> <font color="#444444">+55 61 99994-3569</font></font></div><div><font size="4" face="verdana, sans-serif"><font color="#351c75">Website:</font> <a href="https://www.udemy.com/course/qgis-server-para-iniciantes-instalacao-e-configuracao/" target="_blank">GIS</a></font></div></div></div></div></div>