Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
shubhamamilkant
Helper II
Helper II

Unable to load data. DataSource.Error: ODBC: ERROR [HY000] Error while executing the query

I am trying to load postgres database tables through ODBC. I can load some tables from the database but i get above error while trying to load other tables. 

If i check it on my terminal for logs , database is receiving folliwng query - 

2020-03-06T14:52:17+00:00 app[postgres.23932]: [CRIMSON] [517-2]  sql_error_code = 42601 STATEMENT:  select ta.attname, ia.attnum, ic.relname, n.nspname, tc.relname from pg_catalog.pg_attribute ta, pg_catalog.pg_attribute ia, pg_catalog.pg_class tc, pg_catalog.pg_index i, pg_catalog.pg_namespace n, pg_catalog.pg_class ic where tc.relname = 'accounts_users' AND n.nspname = 'public' AND tc.oid = i.indrelid AND n.oid = tc.relnamespace AND i.indisprimary = 't' AND ia.attrelid = i.indexrelid AND ta.attrelid = i.indrelid AND ta.attnum = i.indkey[ia.attnum-1] AND (NOT ta.attisdropped) AND (NOT ia.attisdropped) AND ic.oid = i.indexrelid order by ia.attnumselect ta.attname, ia.attnum, ic.relname, n.nspname, NULL from pg_catalog.pg_attribute ta, pg_catalog.pg_attribute ia, pg_catalog.pg_class ic, pg_catalog.pg_index i, pg_catalog.pg_namespace n where ic.relname = 'accounts_users_pkey' AND n.nspname = 'public' AND ic.oid = i.indexrelid AND n.oid =
 
 
I am not sure why it is working for certain tables but not evry tables? 
3 REPLIES 3
v-juanli-msft
Community Support
Community Support

Hi @shubhamamilkant 

Error code 42601 means there is a syntax error.

Please check if your statement is correct.

 

When i check your sql statement, it is hard to understand what this code realized.

Your code is like

select ** from **where*** order by *** select** from** where***

 

Based on my knowledge, the basic structure of sql statement is like:

select **** from *** where*** order by****

 

It doesn't support to add "select" statement after  "Order by columns...".

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Yes, you are correct, it looks like syntax error. But only thing i have done is select on a table (click) and then selected the load button in power bi. I have not written any syntax and that's why i am confused why its giving me the syntax error, even when I have not written single word (statement) of sql. above query is auto generated by power bi.

Can someone help me with this!!!

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors