Skip to content

Commit a808eec

Browse files
committed
Improved error message for analyze with missing table
1 parent 03c2376 commit a808eec

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

lib/pgslice/cli/analyze.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class CLI
55
def analyze(table)
66
table = create_table(table)
77
parent_table = options[:swapped] ? table : table.intermediate_table
8+
assert_table(parent_table)
89

910
_, _, _, _, declarative, _ = parent_table.fetch_settings(table.trigger_name)
1011
analyze_list = declarative ? [parent_table] : (parent_table.partitions + [parent_table])

test/pgslice_test.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,30 @@ def test_prep_missing_table
6969
assert_error "Table not found", "prep Items"
7070
end
7171

72+
def test_add_partitions_missing_table
73+
assert_error "Table not found", "add_partitions Items"
74+
end
75+
76+
def test_fill_missing_table
77+
assert_error "Table not found", "fill Items"
78+
end
79+
80+
def test_analyze_table
81+
assert_error "Table not found", "analyze Items"
82+
end
83+
84+
def test_swap_table
85+
assert_error "Table not found", "swap Items"
86+
end
87+
88+
def test_unswap_table
89+
assert_error "Table not found", "unswap Items"
90+
end
91+
92+
def test_unprep_table
93+
assert_error "Table not found", "unprep Items"
94+
end
95+
7296
private
7397

7498
def assert_period(period, column: "createdAt", trigger_based: false, tablespace: false, version: nil)

0 commit comments

Comments
 (0)