Bug report #130

database default fields

Added by Redmine Admin almost 18 years ago. Updated over 14 years ago.

Status:Closed
Priority:Low
Assignee:Brendan Morley -
Category:Digitising
Affected QGIS version: Regression?:No
Operating System:All Easy fix?:No
Pull Request or Patch supplied: Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:10189

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.

Untitled.png - Example of working default postgres fields (23.9 KB) Gavin Macaulay -, 2006-09-01 03:45 AM

defaults.png - more working defaults (17.1 KB) Jürgen Fischer, 2008-05-01 03:45 AM

Bildschirmphoto2.png - Non working GUI from r8394 (15.8 KB) Horst Düster, 2008-05-02 12:39 AM

History

#1 Updated by Marco Hugentobler almost 18 years ago

This is changed in 44339a85 (SVN r5510) 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?

#2 Updated by Redmine Admin almost 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.

#3 Updated by Gavin Macaulay - almost 18 years ago

  • Status changed from Open to Closed
  • Resolution set to fixed

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

#4 Updated by Redmine Admin over 17 years ago

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

#5 Updated by Redmine Admin over 17 years ago

  • Resolution deleted (fixed)
  • Status changed from Closed to Feedback

#6 Updated by Brendan Morley - over 17 years ago

  • Status changed from Feedback to Open

#7 Updated by Brendan Morley - over 17 years ago

  • Status changed from Open to Closed
  • Resolution set to worksforme

Works for me as of today, and I'm not sure how 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.

#8 Updated by venturato-faunalia-it - over 17 years ago

  • Resolution deleted (worksforme)
  • Status changed from Closed to Feedback

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

#9 Updated by venturato-faunalia-it - over 17 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).

#10 Updated by Gavin Macaulay - over 17 years ago

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

#11 Updated by venturato-faunalia-it - over 17 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);
);

#12 Updated by Gavin Macaulay - over 17 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.

#13 Updated by venturato-faunalia-it - over 17 years ago

  • Status changed from Feedback to Closed
  • Resolution set to fixed

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.

#14 Updated by Horst Düster almost 16 years ago

  • Status changed from Closed to Feedback
  • Resolution deleted (fixed)

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

#15 Updated by Jürgen Fischer almost 16 years ago

  • Resolution set to fixed
  • Status changed from Feedback to Closed

fixed in

#16 Updated by Horst Düster almost 16 years ago

  • Resolution deleted (fixed)
  • Status changed from Closed to Feedback

Replying to [comment:15 jef]:

fixed in

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

Is it my fault??

#17 Updated by Jürgen Fischer almost 16 years ago

Replying to [comment:16 hdus]:

Replying to [comment:15 jef]:

fixed in

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?

#18 Updated by Horst Düster almost 16 years ago

Replying to [comment:17 jef]:

Replying to [comment:16 hdus]:

Replying to [comment:15 jef]:

fixed in

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.

#19 Updated by Horst Düster almost 16 years ago

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

#20 Updated by Marco Hugentobler almost 16 years ago

  • Status changed from Feedback to Closed
  • Resolution set to fixed

If it works or not seems to depend on the Qt version. The last try is 7af5433f (SVN r8436). 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 7af5433f (SVN r8436).

Marco

#21 Updated by Jürgen Fischer almost 16 years ago

Replying to [comment:20 mhugent]:

If it works or not seems to depend on the Qt version. The last try is 7af5433f (SVN r8436). 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 7af5433f (SVN r8436).

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

e6b0e02e (SVN r8437) now works on both.

#22 Updated by Anonymous over 14 years ago

Milestone Version 0.9.2 deleted

Also available in: Atom PDF