Opened 18 years ago

Closed 16 years ago

Last modified 15 years ago

#130 closed bug (fixed)

database default fields

Reported by: cavallini@… Owned by: morb_au
Priority: major: does not work as expected Milestone:
Component: Digitising Version: Trunk
Keywords: PostGIS database digitizing Cc: jef
Must Fix for Release: Yes Platform: All
Platform Version: Awaiting user input: no

Description

When inserting data in postgis, qgis does not take the default values from the database (eg nextvalue in cat, etc.). The user have to fill up all fields. This is very unconvenient.

Attachments (3)

Untitled.png (23.9 KB ) - added by g_j_m 18 years ago.
Example of working default postgres fields
defaults.png (17.1 KB ) - added by jef 16 years ago.
more working defaults
Bildschirmphoto2.png (15.8 KB ) - added by hdus 16 years ago.
Non working GUI from r8394

Download all attachments as: .zip

Change History (25)

comment:1 by mhugent, 18 years ago

This is changed in r5509 to take DEFAULT as default value for the postgres provider instead of NULL. Unfortunately, i don't have a database with default values to test. Could you test it with your database and close the bug if it works?

comment:2 by cavallini@…, 18 years ago

It works - great improvement. To be really perfect, default values should show up in the dable during digitizing, otherwise the user has no way of kwowing which values will be filled automatically.

comment:3 by g_j_m, 18 years ago

Resolution: fixed
Status: newclosed

Default fields now show the postgres default value. Note that this includes an explicit postgres style cast (e.g., 'abc'::text). Available in SVN r5602.

comment:4 by cavallini@…, 18 years ago

after commit #5694 (fix for bugs 131 and 134), default fields are no longer shown

comment:5 by cavallini@…, 18 years ago

Resolution: fixed
Status: closedreopened

comment:6 by morb_au, 18 years ago

Owner: changed from gsherman to morb_au
Status: reopenednew

comment:7 by morb_au, 18 years ago

Resolution: worksforme
Status: newclosed

Works for me as of today, and I'm not sure how r5694 would have broken it ...

If somebody else can reproduce this behaviour, please re-open.

I suppose there's the possibility that my working copy is more functional than the HEAD version, but I'd like someone else to confirm before I spend time on that.

comment:8 by venturato@…, 18 years ago

Resolution: worksforme
Status: closedreopened

We confirm that it is not working: default fields are not pre-filled (r 5742).

comment:9 by venturato@…, 18 years ago

Further testing: the default values are actually committed (which is good), they're just not shown in the dialog window (which is not good, as the user cannot know which values should be filled).

comment:10 by g_j_m, 18 years ago

Works for me. What is the definition of your table?

comment:11 by venturato@…, 18 years ago

CREATE TABLE fix (

cat integer DEFAULT nextval('cat_fix'::regclass) NOT NULL, id_radio smallint, data date, ora time without time zone, meteo character varying(2), vento smallint, terreno character varying(1), zona character varying(2), attivita boolean, ambiente character varying, visto boolean, note text, verificato_db boolean, cova boolean DEFAULT false, morto boolean DEFAULT false, schiusa boolean DEFAULT false, operatore character varying, anno smallint DEFAULT 2006, the_geom public.geometry, nido boolean DEFAULT false);

);

by g_j_m, 18 years ago

Attachment: Untitled.png added

Example of working default postgres fields

comment:12 by g_j_m, 18 years ago

That table definition works for me - see attachment. What version of postgres are you using? I can't think of much else that could be causing the problem.

comment:13 by venturato@…, 18 years ago

Resolution: fixed
Status: reopenedclosed

version


PostgreSQL 8.1.4 on x86_64-pc-linux-gnu, compiled by GCC cc (GCC) 4.1.2 20060729 (prerelease) (Debian 4.1.1-10)

Now is working also for me. I don't know why. I just run with gdb for other questions. Sorry and thank you for all.

comment:14 by hdus, 16 years ago

Awaiting user input: unset
Cc: jef added
Milestone: Version 0.8Version 0.9.2
Must Fix for Release: Yes
Platform: DebianAll
Platform Version: etch
Priority: minor: annoyance or enhancementmajor: does not work as expected
Resolution: fixed
Status: closedreopened
Type: defectbug

I reopen this ticket due to QGIS 0.10.0 shows the same behaviour.

comment:15 by jef, 16 years ago

Resolution: fixed
Status: reopenedclosed

fixed in r8390

in reply to:  15 ; comment:16 by hdus, 16 years ago

Resolution: fixed
Status: closedreopened

Replying to jef:

fixed in r8390

mmm....

For me it does not work.

  1. Take a layer with columns with default values
  2. Load to QGIS and start editing
  3. Capture a polygon and stop polygon capturing
  4. A GUI for input column values appears and all fields for columns with default values are empty

My System: PostgreSQL 8.3.0 QGIS 0.10.0 r8392

Is it my fault??

in reply to:  16 ; comment:17 by jef, 16 years ago

Awaiting user input: set

Replying to hdus:

Replying to jef:

fixed in r8390

mmm....

For me it does not work.

mmmm..... For me it does. I tested with following table:

CREATE TABLE test (
    myid integer NOT NULL,
    wkb_geometry geometry,
    mytext character varying DEFAULT 'Foo!'::character varying,
    mynr integer,
    mydate date DEFAULT now()
);

and the attribute dialog looks like the attached image and works as expected. What's different in your case?

by jef, 16 years ago

Attachment: defaults.png added

more working defaults

in reply to:  17 comment:18 by hdus, 16 years ago

Replying to jef:

Replying to hdus:

Replying to jef:

fixed in r8390

mmm....

For me it does not work.

mmmm..... For me it does. I tested with following table:

CREATE TABLE test (
    myid integer NOT NULL,
    wkb_geometry geometry,
    mytext character varying DEFAULT 'Foo!'::character varying,
    mynr integer,
    mydate date DEFAULT now()
);

and the attribute dialog looks like the attached image and works as expected. What's different in your case?

I create your table and than I try to capture a polygon. See the attached image as the result. I doesn't work for me.

by hdus, 16 years ago

Attachment: Bildschirmphoto2.png added

Non working GUI from r8394

comment:19 by hdus, 16 years ago

I just installed QGIS 0.10.0 Windows and I don't get default values too.

comment:20 by mhugent, 16 years ago

Resolution: fixed
Status: reopenedclosed

If it works or not seems to depend on the Qt version. The last try is r8435. It did not work for me with Qt-4.3.4 and after the commit it works also with this version. Reopen this patch if you still have problems after r8435.

Marco

in reply to:  20 comment:21 by jef, 16 years ago

Awaiting user input: unset

Replying to mhugent:

If it works or not seems to depend on the Qt version. The last try is r8435. It did not work for me with Qt-4.3.4 and after the commit it works also with this version. Reopen this patch if you still have problems after r8435.

Ok, looks like I tried with Qt 4.4 on Debian unstable only. r8435 doesn't work there. But given this hint, I found that <r8435 didn't work on Windows using Qt 4.3.4 (MSVC build).

r8436 now works on both.

comment:22 by (none), 15 years ago

Milestone: Version 0.9.2

Milestone Version 0.9.2 deleted

Note: See TracTickets for help on using tickets.