duckdb / postgres_scanner

MIT License
194 stars 35 forks source link

duckdb.duckdb.BinderException: Binder Error: table gto_skc_store_step_kpi_summary has 213 columns but 184 values were supplied #227

Open wonb168 opened 1 month ago

wonb168 commented 1 month ago

I am performing calculations in DuckDB and then writing the results back to Greenplum. Since the rows are dynamic and the number of columns changes daily, I need to rebuild the table. The “CREATE TABLE AS” statement in DuckDB does not allow for the addition of distribution keys and compression settings, so I first use the postgres_execute function to create the table and then write the data. However, at this point, I receive an error indicating that the number of columns is different. This is likely because, when attaching, the table structure from Greenplum (i.e., yesterday’s structure) is obtained. How can I access the table that was just created so that I can reattach to it? Or are there any other suggestions?