Tableau ERROR: column reference "datasource" is ambiguous; Error while executing the query Unable to create extract
<p>I am trying to create a tde file from a live data source. I am connecting to multiple materialized views in postgres so the data source is a custom sql query. Everything in the workbook runs fine while live but when I try to extract the data, I receive the error:</p>

<p><code>ERROR: column reference "datasource" is ambiguous; Error while executing the query
Unable to create extract</code></p>

<p>I do have multiple tables with the same field name so I aliased each of the fields accordingly in my custom query. It seems that when Tableau creates their query for extract, the aliasing isn't recognized. Any help is very appreciated.</p>

<pre><code>SELECT
 i.trx_line_id
,i.datasource
,ie.category_type
,ss.trx_line_id
,ss.datasource
,pl.pl_cd


FROM   invoice i

LEFT   JOIN sales_structure ss ON i.trx_line_id = ss.trx_line_id
LEFT   JOIN invoice_ext ie ON i.trx_line_id = ie.trx_line_id
LEFT   JOIN product_level pl ON i.pl_cd = pl.pl_cd

WHERE  ss.sales_team_rpt IN ('a','b')
</code></pre>