periodstructure giving errors...

Very likely you have an invalid period in the periods table.=20
Can you run this and see what happens?
SELECT * FROM period where age(enddate=2Cstartdate) !=3D '1 year'::interval=
and periodtypeid =3D (SELECT periodtypeid from periodtype where name =3D '=
Yearly')=3B

Also=2C you should get an error which will help you to decipher which perio=
d is not correct =2C something like=20
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value vi=
olates unique constraint "in_periodstructure_iso" Detail: Key (iso)=3D(199=
5) already exists.
Best regards=2CJason

···

On Fri=2C Sep 12=2C 2014 at 5:03 PM=2C Moemedi Ntunyane <moemedi.ntunyane@h= otmail.com> wrote:
=0A=
=0A=
=0A=
Hi All

I have this problem while generating the resource tables...all other tables=
are fine except periodstructure...

Process=0A=
failed: PreparedStatementCallback=3B SQL [insert into _periodstructure =0A=
values (?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?)]=3B ERROR: null =
value in column "iso" =0A=
violates not-null constraint=3B nested exception is =0A=
org.postgresql.util.PSQLException: ERROR: null value in column "iso" =0A=
violates not-null constraint =20

Regards=2C

Moemedi Ntunyane
Co-founder KeyInConsulting
                 =0A=

_______________________________________________
=0A=
Mailing list: DHIS 2 developers in Launchpad
=0A=
Post to : dhis2-devs@lists.launchpad.net
=0A=
Unsubscribe : DHIS 2 developers in Launchpad
=0A=
More help : ListHelp - Launchpad Help
=0A=

--=20
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049=0A=
                 =0A=

--=20
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049=0A=
                 =

--_e60fc998-1edb-4c61-839c-6d91e33bff14_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
font-size: 12pt=3B
font-family:Calibri
}
--></style></head>
<body class=3D'hmmessage'><div dir=3D'ltr'>Hi Jason<br>Thnx=2C I had succes=
sfully elimated duplicate records the error still pesist....it complaining =
of ISO column: is this column a date column??<br><br>Process=0A=
failed: PreparedStatementCallback=3B SQL [insert into _periodstructure =0A=
values (?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?)]=3B ERROR: null =
value in column "iso" =0A=
violates not-null constraint=3B nested exception is =0A=
org.postgresql.util.PSQLException: ERROR: null value in column "iso" =0A=
violates not-null constraint.<br><br>Regards=2C<br><br><font style=3D"" col=
or=3D"#00B050" face=3D"Courier New"><b><i><font style=3D"font-size:8pt" siz=
e=3D"1">Moemedi Ntunyane</font><font style=3D"font-size:8pt" size=3D"1"><br=

</font><font style=3D"font-size:8pt" size=3D"1">Co-founder KeyInConsulting=

</font></i></b></font><br><br><br><div><hr id=3D"stopSpelling">Date: Mon=2C=
15 Sep 2014 12:22:31 +0200<br>Subject: Re: [Dhis2-devs] periodstructure gi=
ving errors...<br>From: jason.p.pickering@gmail.com<br>To: moemedi.ntunyane=
@hotmail.com<br>CC: dhis2-devs@lists.launchpad.net<br><br><div dir=3D"ltr">=
So=2C the period&nbsp=3B<span style=3D"font-family:arial=2Csans-serif=3Bfon=
t-size:13px=3B">1589=3B6=3B"2010-02-01"=3B"2010-02-</span><span style=3D"fo=
nt-family:arial=2Csans-serif=3Bfont-size:13px=3B">28 =2C points to a yearly=
period type=2C which is not a year in duration. You are going to need to g=
et rid of it. You will need to do something like</span><div><span style=3D"=
font-family:arial=2Csans-serif=3Bfont-size:13px=3B"><br></span></div><div><=
span style=3D"font-family:arial=2Csans-serif=3Bfont-size:13px=3B">SELECT CO=
UNT(*) FROM datavalue where periodid =3D&nbsp=3B</span><span style=3D"font-=
family:arial=2Csans-serif=3Bfont-size:13px=3B">1589=3B&nbsp=3B</span></div>=
<div><span style=3D"font-family:arial=2Csans-serif=3Bfont-size:13px=3B"><br=

</span></div><div><span style=3D"font-family:arial=2Csans-serif=3Bfont-siz=

e:13px=3B">If you have any records with this periodID=2C you are going to n=
eed to resolve these. This period looks to be monthly=2C so if the data is =
also monthly=2C you should be able to reassign it to a monthly period which=
starts in 2010-02-01 and ends in 2010-02-28=2C if it is already there. You=
could try "SELECT * FROM period where startdate =3D '2010-02-01'::date=3B"=
and see if you get multiple periods for Feb 2010. If you have multiple per=
iods for Feb 2010=2C then you need to do something like</span></div><div><s=
pan style=3D"font-family:arial=2Csans-serif=3Bfont-size:13px=3B"><br></span=

</div><div><span style=3D"font-family:arial=2Csans-serif=3Bfont-size:13px=

=3B">UPDATE datavalue set periodid =3D ???&nbsp=3B</span></div><div><span=
style=3D"font-family:arial=2Csans-serif=3Bfont-size:13px=3B"><br></span></=

<div><span style=3D"font-family:arial=2Csans-serif=3Bfont-size:13px=3B"=
where ??? is the periodid of the "real" Feb 2010 period.&nbsp=3B</span></=
<div><span style=3D"font-family:arial=2Csans-serif=3Bfont-size:13px=3B"=
<br></span></div><div><span style=3D"font-family:arial=2Csans-serif=3Bfont=

-size:13px=3B">Then you should get rid of the bogus Feb 2010 period&nbsp=3B=
</span></div><div><span style=3D"font-family:arial=2Csans-serif=3Bfont-size=
:13px=3B"><br></span></div><div><span style=3D"font-family:arial=2Csans-ser=
if=3Bfont-size:13px=3B">with&nbsp=3B</span></div><div><span style=3D"font-f=
amily:arial=2Csans-serif=3Bfont-size:13px=3B"><br></span></div><div><span s=
tyle=3D"font-family:arial=2Csans-serif=3Bfont-size:13px=3B">DELETE FROM per=
iod where periodid =3D&nbsp=3B</span><span style=3D"font-family:arial=2Csan=
s-serif=3Bfont-size:13px=3B">1589=3B</span></div><div><span style=3D"font-f=
amily:arial=2Csans-serif=3Bfont-size:13px=3B"><br></span></div><div><font f=
ace=3D"arial=2C sans-serif">After that=2C you should clear your cache from =
Data administration.&nbsp=3B</font></div><div><font face=3D"arial=2C sans-s=
erif"><br></font></div><div><font face=3D"arial=2C sans-serif">Do not try a=
ny of this on a production database!!!</font></div><div><font face=3D"arial=
=2C sans-serif"><br></font></div><div><font face=3D"arial=2C sans-serif">Re=
gards=2C</font></div><div><font face=3D"arial=2C sans-serif">Jason</font></=

<div><font face=3D"arial=2C sans-serif"><br></font></div></div><div cla=

ss=3D"ecxgmail_extra"><br><div class=3D"ecxgmail_quote">On Mon=2C Sep 15=2C=
2014 at 12:14 PM=2C Moemedi Ntunyane <span dir=3D"ltr">&lt=3B<a href=3D"ma=
ilto:moemedi.ntunyane@hotmail.com" target=3D"_blank">moemedi.ntunyane@hotma=
il.com</a>&gt=3B</span> wrote:<br><blockquote class=3D"ecxgmail_quote" styl=
e=3D"border-left:1px #ccc solid=3Bpadding-left:1ex=3B">=0A=
=0A=
=0A=
<div><div dir=3D"ltr">Hi Jason<br><br>Thanx=2C I just run the query you gav=
e and no records were available and removed not =3D year(!=3Dyear) and reco=
rds where available. The date format is available as:<br><br>1573=3B6=3B"20=
10-01-01"=3B"2010-01-31"<br>1589=3B6=3B"2010-02-01"=3B"2010-02-28"<br><br>T=
he error available shows that there is key violation for null values for is=
o column in the periodstructure table.<span class=3D"ecxHOEnZb"><font color=
=3D"#888888"><br><br><br><br><font color=3D"#00B050" face=3D"Courier New"><=

<i><font style=3D"font-size:8pt=3B" size=3D"1">Moemedi Ntunyane</font><fo=

nt style=3D"font-size:8pt=3B" size=3D"1"><br></font><font style=3D"font-siz=
e:8pt=3B" size=3D"1">Co-founder KeyInConsulting</font></i></b></font><br></=

</span><div class=3D"ecxhm ecxHOEnZb"><br><br></div><div><div class=3D=

"ecxhm ecxHOEnZb"><hr>Date: Mon=2C 15 Sep 2014 11:46:07 +0200<br>Subject: R=
e: [Dhis2-devs] periodstructure giving errors...<br>From: <a href=3D"mailto=
:jason.p.pickering@gmail.com" target=3D"_blank">jason.p.pickering@gmail.com=
</a><br>To: <a href=3D"mailto:moemedi.ntunyane@hotmail.com" target=3D"_blan=
k">moemedi.ntunyane@hotmail.com</a><br>CC: <a href=3D"mailto:dhis2-devs@lis=
ts.launchpad.net" target=3D"_blank">dhis2-devs@lists.launchpad.net</a></div=

<div><div class=3D"h5"><br><br><div dir=3D"ltr">Very likely you have an in=

valid period in the periods table.&nbsp=3B<div><br></div><div>Can you run t=
his and see what happens?</div><div><br></div><div>SELECT * FROM period whe=
re age(enddate=2Cstartdate) !=3D '1 year'::interval and periodtypeid =3D (S=
ELECT periodtypeid from periodtype where name =3D 'Yearly')=3B<br></div><di=

<br></div><div>Also=2C you should get an error which will help you to dec=

ipher which period is not correct =2C something like&nbsp=3B</div><div><br>=
</div><div><div>Caused by: org.postgresql.util.PSQLException: ERROR: duplic=
ate key value violates unique constraint "in_periodstructure_iso"</div><div=

&nbsp=3B Detail: Key (iso)=3D(1995) already exists.</div></div><div><br></=
<div>Best regards=2C</div><div>Jason</div><div><br></div></div><div><br=
<div>On Fri=2C Sep 12=2C 2014 at 5:03 PM=2C Moemedi Ntunyane <span dir=3D"=

ltr">&lt=3B<a href=3D"mailto:moemedi.ntunyane@hotmail.com" target=3D"_blank=
">moemedi.ntunyane@hotmail.com</a>&gt=3B</span> wrote:<br><blockquote style=
=3D"border-left:1px #ccc solid=3Bpadding-left:1ex=3B">=0A=
=0A=
=0A=
<div><div dir=3D"ltr">Hi All<br><br>I have this problem while generating th=
e resource tables...all other tables are fine except periodstructure...<br>=
<br>Process=0A=
failed: PreparedStatementCallback=3B SQL [insert into _periodstructure =0A=
values (?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?=2C?)]=3B ERROR: null =
value in column "iso" =0A=
violates not-null constraint=3B nested exception is =0A=
org.postgresql.util.PSQLException: ERROR: null value in column "iso" =0A=
violates not-null constraint &nbsp=3B<img src=3D"http&#58=3B//localhost&#58=
=3B8080/dhis2/images/error_small.png"><br><br>Regards=2C<br><br><font color=
=3D"#00B050" face=3D"Courier New"><b><i><font style=3D"font-size:8pt=3B" si=
ze=3D"1">Moemedi Ntunyane</font><font style=3D"font-size:8pt=3B" size=3D"1"=

<br></font><font style=3D"font-size:8pt=3B" size=3D"1">Co-founder KeyInCon=

sulting</font></i></b></font><br> </div></div>=0A=
<br>_______________________________________________<br>=0A=
Mailing list: <a href=3D"DHIS 2 developers in Launchpad" target=3D"_blan=
k">DHIS 2 developers in Launchpad</a><br>=0A=
Post to&nbsp=3B &nbsp=3B &nbsp=3B: <a href=3D"mailto:dhis2-devs@lists.launc=
hpad.net" target=3D"_blank">dhis2-devs@lists.launchpad.net</a><br>=0A=
Unsubscribe : <a href=3D"DHIS 2 developers in Launchpad" target=3D"_blan=
k">DHIS 2 developers in Launchpad</a><br>=0A=
More help&nbsp=3B &nbsp=3B: <a href=3D"ListHelp - Launchpad Help"=
target=3D"_blank">ListHelp - Launchpad Help</a><br>=0A=
<br></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div dir=
=3D"ltr">Jason P. Pickering<br>email: <a href=3D"mailto:jason.p.pickering@g=
mail.com" target=3D"_blank">jason.p.pickering@gmail.com</a><br>tel:<a targe=
t=3D"_blank">+46764147049</a></div>=0A=
</div></div></div></div> </div></div>=0A=
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div dir=3D"=
ltr">Jason P. Pickering<br>email: <a href=3D"mailto:jason.p.pickering@gmail=
.com" target=3D"_blank">jason.p.pickering@gmail.com</a><br>tel:+46764147049=
</div>=0A=
</div></div> </div></body>
</html>=

--_e60fc998-1edb-4c61-839c-6d91e33bff14_--