[Qgis-user] QGis 1.7.4 possible bug with PostgreSQL/Postgis manual integer primary key?

F T oukile at gmail.com
Fri May 18 02:58:13 PDT 2012


What a reactivity !
Thank you very much Lee.

It is exactly the behaviour we need.

Fabrice


2012/5/17 Lee Hachadoorian <Lee.Hachadoorian+L at gmail.com>

> Fabrice,
>
> I filed a bug report, and it turns out this has already been fixed in
> the development version.
>
> http://hub.qgis.org/issues/5608
>
> --Lee
>
> On Wed, May 16, 2012 at 1:39 PM, Lee Hachadoorian
> <Lee.Hachadoorian+L at gmail.com> wrote:
> >
> >
> > On 05/16/2012 02:41 AM, Bernhard Ströbl wrote:
> >>
> >> I agree, so if the user enters a value it should be passed to the
> database
> >> and not discarded. If it violates any database rules postgresql
> complains
> >> anyways. So this could be a bug then.
> >>>
> >>>
> >>> BTW, I found I could *edit* the primary key field of a table with a
> >>> key field typed as serial, but when I tried to add a new feature, any
> >>> value entered manually generated a primary key violation. The column
> >>> value in QGIS defaulted to nextval('sequence_name'::regclass),
> >>> matching the column default in the table definition, but also
> >>> generated a primary key violation. When I cleared the field
> >>> completely, the row was added with the next available value from the
> >>> sequence.
> >>
> >>
> >> not confirmed here (PostgreSQL 8.4, QGIS 1.7.4)
> >> primary key is integer with a nextval('sequence') default
> >> adding features the key field defaults to nextval('sequence')
> >> case 1) no change => nextval applied
> >> case 2) change value => nextval applied (no error, though)
> >>
> >> expected behaviour for case 2) would be to not apply the default
> >> shall we file a ticket for this?
> >>
> >> Bernhard
> >
> > OK, I have added a ticket for this behavior. Note that my previous
> > complaint--any supplied value generates a primary key violation--was
> tested
> > on Windows. Testing just now on Ubuntu, I observe same behavior as you
> and
> > OP. I have filed the ticket accordingly. I want to retest on Windows, and
> > then will amend ticket or file new bug report.
> >
> >
> >>>>>
> >>>>> I found a workaround : if I change the field type of the key from
> >>>>> integer to bigint then everything works as attended...
> >>>>> QGis doesnt tries anymore to give a value when we don't need it.
> >>>>> But this is not very logical isn't it?
> >>>>>
> >>>>> Fabrice
> >
> > Fabrice, it seems that QGIS does allow you to edit an existing feature,
> so
> > another workaround would be to add feature, save changes allowing
> Postgres
> > to assign default value from sequence, then edit to change to the desired
> > value.
> >
> > --Lee
> >
> > --
> > Lee Hachadoorian
> > PhD, Earth&  Environmental Sciences (Geography)
> > Research Associate, CUNY Center for Urban Research
> > http://freecity.commons.gc.cuny.edu
> >
>
>
>
> --
> Lee Hachadoorian
> PhD, Earth & Environmental Sciences (Geography)
> Research Associate, CUNY Center for Urban Research
> http://freecity.commons.gc.cuny.edu/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20120518/0999b15f/attachment.html>


More information about the Qgis-user mailing list