Added rescue for PG::UndefinedColumn on update_table_geom_pg_stats

pull/14841/head
antoniocarlon 5 years ago
parent b25c45d393
commit 23b6789eb2

@ -56,6 +56,7 @@ Development
- Fix minor CSS issues in Groups and Add groups panels ([#14786](https://github.com/CartoDB/cartodb/issues/14786)) - Fix minor CSS issues in Groups and Add groups panels ([#14786](https://github.com/CartoDB/cartodb/issues/14786))
- Add badge for first onboarding visitors [#14831](https://github.com/CartoDB/cartodb/pull/14831) - Add badge for first onboarding visitors [#14831](https://github.com/CartoDB/cartodb/pull/14831)
- Fix "Duplicate datasets" action in the dashboard [#2023](https://github.com/CartoDB/support/issues/2023) - Fix "Duplicate datasets" action in the dashboard [#2023](https://github.com/CartoDB/support/issues/2023)
- Add rescue for PG::UndefinedColumn on update_table_geom_pg_stats [#2034](https://github.com/CartoDB/support/issues/2034)
4.26.0 (2019-03-11) 4.26.0 (2019-03-11)
------------------- -------------------

@ -993,6 +993,8 @@ class Table
rescue StandardError => exception rescue StandardError => exception
if exception.message =~ /canceling statement due to statement timeout/i if exception.message =~ /canceling statement due to statement timeout/i
CartoDB::Logger.info(exception: exception, message: 'Analyze in import raised statement timeout') CartoDB::Logger.info(exception: exception, message: 'Analyze in import raised statement timeout')
elsif exception.cause.is_a?(PG::UndefinedColumn)
CartoDB::Logger.info(exception: exception, message: 'Analyze in import raised column "the_geom" does not exist')
else else
raise exception raise exception
end end

@ -1400,6 +1400,21 @@ describe Table do
table.rows_counted.should == 7 table.rows_counted.should == 7
end end
it "should not fail when the analyze is executed in update_table_geom_pg_stats and raises a PG::UndefinedColumn" do
delete_user_data @user
old_user_timeout = @user.user_timeout
old_user_db_timeout = @user.database_timeout
data_import = DataImport.create(user_id: @user.id,
data_source: fake_data_path('import_raster.tif.zip'))
data_import.run_import!
table = Table.new(user_table: UserTable[data_import.table_id])
table.should_not be_nil, "Import failure: #{data_import.log}"
table.name.should match(/^import_raster/)
table.update_table_geom_pg_stats
end
it "should not drop a table that exists when upload fails" do it "should not drop a table that exists when upload fails" do
delete_user_data @user delete_user_data @user
table = new_table :name => 'empty_file', :user_id => @user.id table = new_table :name => 'empty_file', :user_id => @user.id

Loading…
Cancel
Save