Commit 54b4b03
committed
Handle better the hint table if the extension is not created
An environment enabling pg_hint_plan.enable_hint_table while
pg_hint_plan has not been created as an extension would fail all its
queries as the table created by the extension does not exist.
This commit adds a check at the top of get_hints_from_table() to check
if the extension is installed before attempting to use the hint table,
generating a WARNING. We have discussed about a few options, but a
WARNING is more consistent with how duplicated hints or compute_query_id
disabled are handled.
This does not completely close the failure hole, though, as it is still
possible to see the table lookup failure for the CREATE EXTENSION
command enabling pg_hint_plan as an extension if enable_hint_table is
enabled. In terms of code simplicity, I am not really convinced that
we need to do more just for that.
This commit relies on 490f869d92e5 that has introduced syscache entries
for pg_extension. On stable branches, we will need a different logic
with a check on the table itself with its namespace.
Idea based on some feedback from Julien Rouhaud. The tests are from me.
Author: Sami Imseih, Michael Paquier
Backpatch-through: 12
Per issue #191.1 parent 0347b9d commit 54b4b03
File tree
4 files changed
+59
-1
lines changed- expected
- sql
4 files changed
+59
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
1891 | 1892 | | |
1892 | 1893 | | |
1893 | 1894 | | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
1894 | 1914 | | |
1895 | 1915 | | |
1896 | 1916 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments