File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed
Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -108,7 +108,11 @@ flex_table_t::build_sql_create_table(table_type ttype,
108108 ttype == table_type::interim ? " UNLOGGED" : " " , table_name);
109109
110110 for (auto const &column : m_columns) {
111- sql += column.sql_create ();
111+ // create_only columns are only created in permanent, not in the
112+ // interim tables
113+ if (ttype == table_type::permanent || !column.create_only ()) {
114+ sql += column.sql_create ();
115+ }
112116 }
113117
114118 assert (sql.back () == ' ,' );
@@ -214,8 +218,9 @@ void table_connection_t::stop(bool updateable, bool append)
214218 m_db_connection->exec (table ().build_sql_create_table (
215219 flex_table_t ::table_type::permanent, table ().full_tmp_name ()));
216220
217- std::string sql = " INSERT INTO {} SELECT * FROM {}" _format (
218- table ().full_tmp_name (), table ().full_name ());
221+ std::string const columns = table ().build_sql_column_list ();
222+ std::string sql = " INSERT INTO {} ({}) SELECT {} FROM {}" _format (
223+ table ().full_tmp_name (), columns, columns, table ().full_name ());
219224
220225 auto const postgis_version = get_postgis_version (*m_db_connection);
221226
You can’t perform that action at this time.
0 commit comments