<p dir="ltr"></p>
<p dir="ltr">On 17 Nov 2016 12:54 AM, "Carlo A. Bertelli (Charta s.r.l.)" <<a href="mailto:carlo.bertelli@gmail.com">carlo.bertelli@gmail.com</a>> wrote:<br>
><br>
> Ciao Andrea,<br>
> by default Postgresql views are read only. Even the simplest view made in Postgresql needs a rule to be updated.</p>
<p dir="ltr">That's not quite correct. Recent versions of postgres make simple views editable.<br>
See</p>
<p dir="ltr"><a href="https://www.depesz.com/2012/12/11/waiting-for-9-3-support-automatically-updatable-views/">https://www.depesz.com/2012/12/11/waiting-for-9-3-support-automatically-updatable-views/</a></p>
<p dir="ltr">Nyall<br><br></p>
<p dir="ltr"> After writing a statement for a view, just take the habit of writing the rules for insert, update, delete.<br>
> Please read the chapter on the Rule System in the Postgresql Reference Manual for the instructions.<br>
> c<br>
><br>
> Message: 6<br>
> Date: Wed, 16 Nov 2016 09:39:23 +0100<br>
> From: Andrea Peri <<a href="mailto:aperi2007@gmail.com">aperi2007@gmail.com</a>><br>
> To: Matthias Kuhn <<a href="mailto:matthias@opengis.ch">matthias@opengis.ch</a>><br>
> Cc: qgis-user <<a href="mailto:qgis-user@lists.osgeo.org">qgis-user@lists.osgeo.org</a>><br>
> Subject: Re: [Qgis-user] Editing a Postgis view<br>
> Message-ID:<br>
>         <CABqTJk8Bo7fs6qOG=MhO9N50qO5L+JkXAOAgik=<a href="mailto:tUGWwcKd-WA@mail.gmail.com">tUGWwcKd-WA@mail.gmail.com</a>><br>
> Content-Type: text/plain; charset=UTF-8<br>
><br>
> Hi Matthias,<br>
> thx for response.<br>
> So the trouble is in my db.<br>
><br>
> Now I try to understand better why it is not working.<br>
><br>
> This is my actual try test:<br>
><br>
> create table schemaapp.repository(<br>
>  ID serial primary key NOT NULL,<br>
>  UUID varchar(50) NOT NULL,<br>
>  PROGETTO varchar(9) NOT NULL,<br>
>  PROCEDIMENTO text NOT NULL,<br>
>  GEOMETRIA1 geometry(MULTIPOINT, 3003)<br>
> );<br>
><br>
> create view schemaapp.v_repository_point as<br>
>  select<br>
>   <a href="http://a.id">a.id</a> as id,<br>
>   a.uuid as uuid,<br>
>   a.progetto as progetto,<br>
>   a.procedimento as procedimento,<br>
>   a.geometria1 as geometria<br>
> from<br>
>   schemappa.repository_wfs as a<br>
> where<br>
>   a.geometria1 is not null;<br>
><br>
> I will know if discover something.<br>
> thx again.<br>
><br>
> 2016-11-16 8:54 GMT+01:00 Matthias Kuhn <<a href="mailto:matthias@opengis.ch">matthias@opengis.ch</a>>:<br>
> > Hi Andrea,<br>
> ><br>
> > It works here.<br>
> > Do you have an instead of insert rule written on your view?<br>
> > It works for me this way (but my views are too complicated for postgres<br>
> > to create default insert rules by default anyway).<br>
> > You can also try to alter your view with a default value for the column<br>
> > in question.<br>
> ><br>
> > Best regards<br>
> > Matthias<br>
> ><br>
> > On 11/16/2016 08:15 AM, Andrea Peri wrote:<br>
> >> Hi,<br>
> >> I'm having some trouble to edit a postgis view using qgis.<br>
> >><br>
> >> The view is a simple:<br>
> >> select list-of-field from table1;<br>
> >><br>
> >> And the table1 is a table with a Primary key on a serial type field.<br>
> >><br>
> >> I add the first record and all was ok. The commit too.<br>
> >> When go to add the second record.<br>
> >> I start to have trouble.<br>
> >> The qgis report my always a constraint violation of the pk.<br>
> >> I try to leave the pk field empty, or try to fill it with a value.<br>
> >> No solution work.<br>
> >><br>
> >> So my question is if is confirmed that qgis (I use the 2.18) version)<br>
> >> is working in editing with a postgis view .<br>
> >><br>
> >> Thx.<br>
> >> A.<br>
> >><br>
> >><br>
> >><br>
> > _______________________________________________<br>
> > Qgis-user mailing list<br>
> > <a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
> > List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
> > Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
><br>
><br>
> _______________________________________________<br>
> Qgis-user mailing list<br>
> <a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
> List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
> Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-user">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></p>