# SQLview - protected tables

**URL:** <https://community.dhis2.org/t/sqlview-protected-tables/33930>\
**Category:** Support - Assistance technique\
**Created:** [13 March 2018 10:16 UTC](https://community.dhis2.org/t/sqlview-protected-tables/33930 "2018-03-13T10:16:58Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Calle\_Hedberg](https://dhis2.b-cdn.net/user_avatar/community.dhis2.org/calle_hedberg/32/33875_2.png) [@Calle\_Hedberg](https://community.dhis2.org/u/Calle_Hedberg)\
**Post date:** [13 March 2018 11:15 UTC](https://community.dhis2.org/t/sqlview-protected-tables/33930/2 "2018-03-13T11:15:09Z")

</div>

Hi,

Yes, the main user tables are protected.

If you have access to the “backend” database, you can bypass it using a construct (query/function) that “re-packages” the user table information so that it can be accessed via sql view. Works, but obviously it creates a security risk (the main user tables are protected for a reason).

Regards

Calle

> **···**
>
> On 13 March 2018 at 12:16, Himanshu Ardawatia [himanshu.ardawatia@nrc.no](mailto:himanshu.ardawatia@nrc.no) wrote:
> 
> > Hi,
> 
> > 
> 
> > Getting the following error while trying to get user list for a given organization unit in sql view:
> 
> > 
> 
> > “ **SQL query contains references to protected tables** ”
> 
> > 
> 
> > The query is here:
> 
> > * * *
> 
> > SELECT
> 
> > userinfo.surname,
> 
> > userinfo.firstname,
> 
> > [organisationunit.name](http://organisationunit.name)
> 
> > FROM
> 
> > public.usermembership,
> 
> > public.userinfo,
> 
> > public.organisationunit
> 
> > WHERE
> 
> > usermembership.userinfoid = userinfo.userinfoid AND
> 
> > organisationunit.organisationunitid = usermembership.organisationunitid;
> 
> > 
> 
> > * * *
> 
> > 
> 
> > Perhaps the userinfo table is protected. Is there a workaround this so the said data can be accessed? OR any other method?
> 
> > 
> 
> > Thanks,
> 
> > Himanshu
> 
> > 
> 
> > * * *
> > 
> > Mailing list: [https://launchpad.net/~dhis2-devs](https://launchpad.net/~dhis2-devs)
> > 
> > Post to : [dhis2-devs@lists.launchpad.net](mailto:dhis2-devs@lists.launchpad.net)
> > 
> > Unsubscribe : [https://launchpad.net/~dhis2-devs](https://launchpad.net/~dhis2-devs)
> > 
> > More help : [https://help.launchpad.net/ListHelp](https://help.launchpad.net/ListHelp)
> 
> –
> 
> * * *
> 
> Calle Hedberg
> 
> 46D Alma Road, 7700 Rosebank, SOUTH AFRICA
> 
> Tel/fax (home): +27-21-685-6472
> 
> Cell: +27-82-853-5352
> 
> Iridium SatPhone: +8816-315-19119
> 
> Email: [calle.hedberg@gmail.com](mailto:calle.hedberg@gmail.com)
> 
> Skype: calle\_hedberg
> 
> * * *

---

_[View the full topic](https://community.dhis2.org/t/sqlview-protected-tables/33930)._
