How to access a table in external data source

I have been able to successfully connect to my external data source. In my external data source there is a table named "user". I have been able to access other tables but not able to access this one.
Also when I am typing the name of this table it is coming up in different color (PFA the image attached).

1 Like

Hey @prsahu. This problem might be related to the fact that USER is a pseudo-keyword in Postgres, and refers to the current user. It seems like you can work around this by enclosing it in quotes:

select * from "user" JOIN project ON project.creator_id = "user.id"

More info here: https://dba.stackexchange.com/questions/75551/returning-rows-in-postgresql-with-a-table-called-user. Let me know if this works!

1 Like

Hey @justin,
Thanks for the quick reply.
I was able to get this query working : select * from “user”
However, this one is still failing : select * from “user” JOIN project ON project.creator_id = “user.id”

Great! Can you try aliasing the table to avoid that issue? Something like:

select * from "user" u join project on project.creator_id = u.id

1 Like

Thanks! This works, but can you help me with the following query?
select project.client_name,project.carpet_area,sbu.name,project.created_at,project.status,“user.name” from project JOIN project_sbu ON project.id= project_sbu.project_id JOIN sbu ON project_sbu.sbu_id=sbu.id JOIN “user” u ON project.creator_id=u.id WHERE project.delete_status=‘NO_REQUEST’

I want to include the u.name as one of the selected columns.

Did you try putting in u.name in your select statement? Once you’ve aliased the table as u in your from clause that carries over to the entire SQL statement.

1 Like

That worked! Thanks for your help!

1 Like