← Back to team overview

dhis2-users team mailing list archive

hibernate_sequence is working by default in Postgres

 

Dear All,
 I converted MySql Database In Postgres with Data.  Conversion is good.

However, I face few bugs about insert new dataelement or datset.  It is
shows duplicate id.

For solving this bug, I created dataelementid_seq sequence for auto
incremented dataelement id and set as a default value of dataelemtid column
in dataelement table.

Unfortunately, Now If  i am create a new dataelemt then it is not taking
the default value which one i set in dataelementid colum. It is taking the
curvalue of hibernate_sequence. Not from my new dataelementid_seq.

The sequence step are follows:
----------------
CREATE SEQUENCE dataelementid_seq
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 1
  CACHE 1;
ALTER TABLE dataelementid_seq
  OWNER TO postgres;

SELECT MAX(dataelementid) FROM dataelement
SELECT nextval('dataelementid_seq');
SELECT setval('dataelementid_seq', (SELECT MAX(dataelementid) FROM
dataelement));

Set default value: nextval('dataelementid_seq'::regclass)
-----------------
Have any one any solution about default value.

*Fatema Uddin**
*----------------------------------------
*Junior Advisor HIS*
Priority Area Health
Deutsche Gesellschaft für Internationale Zusammenarbeit (GIZ) GmbH
House10/A, Road 90, Gulshan 2, Dhaka 1212, Bangladesh
*Office location:*
Monitoring & Evaluation Unit
Ministry of Health and Family Welfare
Janashankha Bhaban (2nd Floor), Azimpur
Dhaka 1205, Bangladesh

Phone: +880 2 966 53 13
Fax:   +880 2 966 53 14
**