firtst release
Revision | 788cf4b133728f7a4c1e521ba135a7cd9fb777aa (tree) |
---|---|
Time | 2020-02-17 13:45:33 |
Author | Kyotaro Horiguchi <horikyota.ntt@gmai...> |
Commiter | Kyotaro Horiguchi |
Give correct query location to generate_normalized_query.
There was a thinko about query_loc of generate_normalized_query which
causes a crash. For example a query is following a sequence of
semicolons (by \; in psql input) longer than the length after the last
placeholder to the end of the query, the function causes assertion
failure. Anyway prepared statements lose that value so we just pass 0
as the query_loc for consistent behavior.
@@ -127,5 +127,12 @@ error hint: | ||
127 | 127 | (2 rows) |
128 | 128 | |
129 | 129 | DEALLOCATE p1; |
130 | +-- Check proper calling to generate_normalized_query | |
131 | +\;\;SELECT 1,2; | |
132 | + ?column? | ?column? | |
133 | +----------+---------- | |
134 | + 1 | 2 | |
135 | +(1 row) | |
136 | + | |
130 | 137 | SET pg_hint_plan.enable_hint_table to off; |
131 | 138 | DELETE FROM hint_plan.hints; |
@@ -2873,9 +2873,7 @@ get_current_hint_string(ParseState *pstate, Query *query) | ||
2873 | 2873 | */ |
2874 | 2874 | query_len = strlen(query_str) + 1; |
2875 | 2875 | normalized_query = |
2876 | - generate_normalized_query(&jstate, query_str, | |
2877 | - query->stmt_location, | |
2878 | - &query_len, | |
2876 | + generate_normalized_query(&jstate, query_str, 0, &query_len, | |
2879 | 2877 | GetDatabaseEncoding()); |
2880 | 2878 | |
2881 | 2879 | /* |
@@ -41,5 +41,9 @@ EXPLAIN CREATE TABLE ct1 AS EXECUTE p1; | ||
41 | 41 | |
42 | 42 | DEALLOCATE p1; |
43 | 43 | |
44 | +-- Check proper calling to generate_normalized_query | |
45 | +\;\;SELECT 1,2; | |
46 | + | |
44 | 47 | SET pg_hint_plan.enable_hint_table to off; |
45 | 48 | DELETE FROM hint_plan.hints; |
49 | + |