Forum Discussion

sande_ch's avatar
sande_ch
Helper I
4 months ago
Solved

Power BI: PostgreSQL Error 42703 (“column does not exist”) when switching to identical table

Hi everyone,

I’m facing an issue in Power BI that I can’t explain.

I have built a fairly complex report with:

  • a complex data model
  • multiple tables imported from PostgreSQL
  • many measures

Now I want to replace one table in the background with another table from the same PostgreSQL database.

  • Both tables have identical structure (same columns, same names, same number of columns)
  • No transformations were applied in Power Query (only Source and Navigation step

When I change the navigation step in Power Query to point to the new table, I get following error:
DataSource.Error: PostgreSQL: 42703: column $Table.stelnahm does not exist
Details:
DataSourceKind=PostgreSQL
Message=42703: column $Table.stelnahm does not exist
Which is confusing, because

  • Neither the old nor the new table contains a column called stelnahm
  • No relationships reference this column
  • None of my measures use this column
  • Power Query shows no additional transformation steps

 

Could Power BI still reference a deleted column or measure in the background? Could this be caused by cached metadata or model dependencies?
Is there any way to inspect or edit the generated SQL query? 

Re-importing the table works, but I would have to rebuild all relationships and measures, which is very time-consuming.


Any ideas or hints would be greatly appreciated!

Thanks in advance
Sandra

 

 

 

 

  • Hi there

    Thank you all very much for the valuable feedback: vojtechsimaNatarajan_M v-hjannapu 

     

    I tried everything. In the end, it turned out that I had to click “Refresh Preview” in Power Query for it to work. I had only clicked “Refresh” when the message “This preview may be up to xx days old” appeared. However, that message didn’t appear for the problematic table, since the error message popped up right away.

     

    So the problem is solved.

     

    Thank you very much for your help!

     

6 Replies

  • Hey, sande_ch ,
    I would first do couple of things:

    1) If you can, download Tabular Editor 2, it's free, and inspect your original data model for anything named as that phantom column; if you did resaved this from another report, it could be hidden somewhere

    2) Clear cache from the settings

    3) I would recommend going to the new report, where your simple M code works, and I would check the native Query, if you don't wanna write SQL yourself, and copy it and apply it do the new query, so you won't use the navigation and folding, but you will use custom query (that's usually the best approach regardless).

     

    To get Native Query, click the working last step of the database query and you should see not greyed out option:

     

  • v-hjannapu's avatar
    v-hjannapu
    Community Support

    Hi sande_ch,

    I would also take a moment to thank vojtechsima , for actively participating in the community forum and for the solutions you’ve been sharing in the community forum. Your contributions make a real difference.
     

    I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions.

    Regards,
    Community Support Team.

  • Hi there

    Thank you all very much for the valuable feedback: vojtechsimaNatarajan_M v-hjannapu 

     

    I tried everything. In the end, it turned out that I had to click “Refresh Preview” in Power Query for it to work. I had only clicked “Refresh” when the message “This preview may be up to xx days old” appeared. However, that message didn’t appear for the problematic table, since the error message popped up right away.

     

    So the problem is solved.

     

    Thank you very much for your help!

     

    • v-hjannapu's avatar
      v-hjannapu
      Community Support

      Hi sande_ch,

      Glad to hear it’s working now .Thanks for confirming the update.

      If you face any other issues or need help in future, feel free to post here. We will be happy to help.

      Regards,
      Community Support Team.

  • Hi there

    The M-Code in Power Query is:
    let Quelle = PostgreSQL.Database("Server", "Database"), powerbi_taritemp_unfallliste_buv = Quelle{[Schema="powerbi",Item="taritemp_unfallliste_buv"]}[Data] in powerbi_taritemp_unfallliste_buv