← Back to team overview

dhis2-devs team mailing list archive

Re: Problems with creating an SQL view in 2.16

 

Not 100% sure, but think is was this

Referenced by:
    TABLE "sqlviewusergroupaccesses" CONSTRAINT "fk39f92993428ceacc"
FOREIGN KEY (sqlviewid) REFERENCES sqlview(viewid)


On Thu, Aug 28, 2014 at 10:15 AM, Lars Helge Øverland <larshelge@xxxxxxxxx>
wrote:

> Sure, that's the problem. We wanted to rename the "viewid" column but
> renaming primary keys is tricky when using hibernate.
>
> We must include a drop constraint on that foreign key, let me know if you
> remember the name of it.
>
> Lars
>
>
>
> On Thu, Aug 28, 2014 at 10:13 AM, Jason Pickering <
> jason.p.pickering@xxxxxxxxx> wrote:
>
>> That does not work, but this does (CAREFUL WITH THIS ONE)
>>
>> alter table sqlview drop column viewid CASCADE;
>>
>> There is a foreign key reference to some other table, but cannot recall
>> which one it was. Something to do with users I think.
>>
>> Regards,
>> Jason
>>
>>
>>
>> On Thu, Aug 28, 2014 at 10:10 AM, Lars Helge Øverland <
>> larshelge@xxxxxxxxx> wrote:
>>
>>> Hi Jason,
>>>
>>> can you execute this on your db and see if the query fails, if so
>>> provide the log?
>>>
>>> alter table sqlview drop column viewid;
>>>
>>> regards,
>>>
>>> Lars
>>>
>>>
>>>
>>> On Thu, Aug 28, 2014 at 9:43 AM, Jason Pickering <
>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>
>>>> Looks like there was an attempt to fix this in rev 14845, but still not
>>>> working for me.
>>>>
>>>> We are using
>>>>
>>>> Version:2.16 Build revision:16370
>>>> Probably could be hacked rather easily, but not sure if things are
>>>> still not fixed properly in the startup routines?
>>>> Regards,Jason
>>>> Caused by: org.postgresql.util.PSQLException: ERROR: null value in
>>>> column "viewid" violates not-null constraint
>>>>   Detail: Failing row contains (null, test sql view, , SELECT uid, name
>>>> from organisationunit LIMIT 10;, bMTwKD2Vpe0, null, 2014-08-28
>>>> 07:41:46.921, 4511, 2014-08-28 07:41:46.921, 2361, rw------).
>>>>         at
>>>> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
>>>>         at
>>>> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
>>>>         at
>>>> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
>>>>         at
>>>> org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560)
>>>>         at
>>>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
>>>>         at
>>>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
>>>>         at
>>>> com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)
>>>>         at
>>>> org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:133)
>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dhis2-devs
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>
>>
>

Follow ups

References