pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Inoue, Hiroshi <h-inoue@dream.email.ne.jp>
To: Fernando Luna <Fernando.Luna@Tideworks.com>
Cc: 'pgsql-odbc@postgresql.org' <pgsql-odbc@postgresql.org>
Subject: Re: Question regarding accessing only tables to which the user has access
Date: Tue, 29 Mar 2016 12:49:09 +0900
Message-ID: <56F9FB35.1000801@dream.email.ne.jp> (raw)
In-Reply-To: <479BB3381124DA41AC6539F10BBF788E2212E727@LWEXMB4.usa.int>
References: <479BB3381124DA41AC6539F10BBF788E2212E727@LWEXMB4.usa.int>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

Hi Fernando,

On 2016/03/29 2:40, Fernando Luna wrote:
>
> I am using Tableau version 9.2 to connect to a PostgreSQL database 
> (version 9.4). This database resides in a VM running Redhat CentOS and 
> I am connecting from my Windows 7 box using the latest Windows driver 
> found under http://www.postgresql.org/ftp/odbc/versions/msi/ . The 
> zipfile name is psqlodbc_09_05_0100-x64.zip 
> <https://ftp.postgresql.org/pub/odbc/versions/msi/psqlodbc_09_05_0100-x64.zip;
>
> My question is this. When Tableau connects it retrieves a list of 
> tables/views to use. My problem is that Tableau is listing tables to 
> which the connected user has no privileges and it makes for a poor 
> user experience to allow Tableau to do that in our case. We want to 
> only list those tables/views to which the connected user has at the 
> very least select privileges. At first I thought it was Tableau doing 
> this and after a while I decided to turn on logging on PostgreSQL and 
> found that the following query is issued whenever I connect using Tableau.
>
> select relname, nspname, relkind
>
>   from pg_catalog.pg_class c, pg_catalog.pg_namespace n
>
> where relkind in ('r', 'v')
>
>    and nspname not in ('pg_catalog', 'information_schema', 'pg_toast', 
> 'pg_temp_1')
>
>    and n.oid = relnamespace
>
> order by nspname, relname
>
> I discovered that this query is executed by the postgres odbc driver 
> on connect. I looked at the source code for the latest driver and 
> found this code snippet in info.c:
>
> if (!list_some)
>
> {
>
> if (CC_accessible_only(conn))
>
> strcat(tables_query, " and has_table_privilege(c.oid, 'select')");
>
> }
>
> My question is, how can I get the driver to add this snippet to the 
> query? Please bear in mind that I know nearly nothing about Postgres 
> and ODBC and would appreciate being pointed in the right direction as 
> to how to influence pgsql odbc to issue the query like this:
>
> select relname, nspname, relkind
>
>   from pg_catalog.pg_class c, pg_catalog.pg_namespace n
>
> where relkind in ('r', 'v')
>
>    and nspname not in ('pg_catalog', 'information_schema', 'pg_toast', 
> 'pg_temp_1')
>
> and has_table_privilege(c.oid, 'select')
>
> and n.oid = relnamespace
>
> order by nspname, relname
>

Please set the "Extra Opts" option of  Advanced Options(Datasource) Page 
2 using ODBC Data Source Administrator.
Try to set Extra Opts to 0x10.

regards,
Hiroshi Inoue

view thread (8+ messages)  latest in thread

Message-ID: <56F9FB35.1000801@dream.email.ne.jp>
Permalink:  ../56F9FB35.1000801@dream.email.ne.jp/
Also on:    postgresql.org/message-id/56F9FB35.1000801@dream.email.ne.jp

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: h-inoue@dream.email.ne.jp, Fernando.Luna@Tideworks.com
  Subject: Re: Question regarding accessing only tables to which the user has access
  In-Reply-To: <56F9FB35.1000801@dream.email.ne.jp>
  References: <479BB3381124DA41AC6539F10BBF788E2212E727@LWEXMB4.usa.int> <56F9FB35.1000801@dream.email.ne.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox