SQL query contains references to protected tables error

I’m trying to create a SQL view in dhis 2.27 but I keeping receiving this error SQL query contains references to protected tables?

Any idea why as I was able to create the view in dhis 2.25 previously and how can i recreate it

Here is my select

SELECT

trackedentityattributevalue.value AS “SystemResolutionNumber”,

trackedentityinstance.uid AS “TrackedEntityInstanceUID”,

trackedentityinstance.trackedentityinstanceid

FROM

public.trackedentityinstance,

public.trackedentityattribute,

public.trackedentityattributevalue

WHERE

trackedentityattributevalue.trackedentityinstanceid = trackedentityinstance.trackedentityinstanceid AND

trackedentityattributevalue.trackedentityattributeid = trackedentityattribute.trackedentityattributeid and

trackedentityattribute.name like ‘System Resolution Number’;

Regards

Pooben

This message and any attachments are subject to a disclaimer published at http://www.hisp.org/policies.html#comms_disclaimer. Please read the disclaimer before opening any attachment or taking any other action in terms of this electronic transmission. If you cannot access the disclaimer, kindly send an email to disclaimer@hisp.org and a copy will be provided to you. By replying to this e-mail or opening any attachment you agree to be bound by the provisions of the disclaimer.

Hi Pooben,
I suspect (but not sure) this has to do with a change made here

https://github.com/dhis2/dhis2-core/commit/5e1cc7c7820950f6540e8e2f1c465ac321e26045

which strips newline characters from SQL queries. This was a weakness which was corrected.

The “Trackedentity” tables are considered to be protected, mostly because they could contain reference to personally identifiable information.

I am not sure, but suspect that your SQL query had new line characters, and even though it should not have worked in 2.25, it did, due to this weakness.

Hope that helps.

Regards,

Jason

···

On Wed, Jul 26, 2017 at 12:51 PM, Pooben Dass pooben@hisp.org wrote:

I’m trying to create a SQL view in dhis 2.27 but I keeping receiving this error SQL query contains references to protected tables?

Any idea why as I was able to create the view in dhis 2.25 previously and how can i recreate it

Here is my select

SELECT

trackedentityattributevalue.value AS “SystemResolutionNumber”,

trackedentityinstance.uid AS “TrackedEntityInstanceUID”,

trackedentityinstance.trackedentityinstanceid

FROM

public.trackedentityinstance,

public.trackedentityattribute,

public.trackedentityattributevalue

WHERE

trackedentityattributevalue.trackedentityinstanceid = trackedentityinstance.trackedentityinstanceid AND

trackedentityattributevalue.trackedentityattributeid = trackedentityattribute.trackedentityattributeid and

trackedentityattribute.name like ‘System Resolution Number’;

Regards

Pooben

This message and any attachments are subject to a disclaimer published at http://www.hisp.org/policies.html#comms_disclaimer. Please read the disclaimer before opening any attachment or taking any other action in terms of this electronic transmission. If you cannot access the disclaimer, kindly send an email to disclaimer@hisp.org and a copy will be provided to you. By replying to this e-mail or opening any attachment you agree to be bound by the provisions of the disclaimer.


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049