Skip to content

Commit b036dd9

Browse files
Marina PolyakovaAlena0704
Marina Polyakova
authored andcommitted
Partial revert "Change names of interface functions for better usage"
This reverts commit f097d8b except for changes to the function invalidate_deactivated_queries_cache.
1 parent 961bdcf commit b036dd9

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

‎aqo--1.4--1.5.sql

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ CREATE VIEW aqo_queries AS SELECT * FROM aqo_queries();
7777
/* UI functions */
7878

7979

80-
CREATE FUNCTION aqo_enable_class(queryid bigint)
80+
CREATE FUNCTION aqo_enable_query(queryid bigint)
8181
RETURNS void
82-
AS 'MODULE_PATHNAME', 'aqo_enable_class'
82+
AS 'MODULE_PATHNAME', 'aqo_enable_query'
8383
LANGUAGE C STRICT VOLATILE;
8484

85-
CREATE FUNCTION aqo_disable_class(queryid bigint)
85+
CREATE FUNCTION aqo_disable_query(queryid bigint)
8686
RETURNS void
87-
AS 'MODULE_PATHNAME', 'aqo_disable_class'
87+
AS 'MODULE_PATHNAME', 'aqo_enable_query'
8888
LANGUAGE C STRICT VOLATILE;
8989

9090
CREATE FUNCTION aqo_queries_update(

‎expected/aqo_CVE-2020-14350.out

+12-12
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ SHOW is_superuser;
116116
off
117117
(1 row)
118118

119-
CREATE FUNCTION aqo_enable_class(hash bigint)
119+
CREATE FUNCTION aqo_enable_query(hash bigint)
120120
RETURNS VOID
121121
AS $$
122122
BEGIN
@@ -125,18 +125,18 @@ $$ LANGUAGE plpgsql;
125125
RESET ROLE;
126126
-- Test result (error expected)
127127
CREATE EXTENSION aqo;
128-
ERROR: function "aqo_enable_class" already exists with same argument types
128+
ERROR: function "aqo_enable_query" already exists with same argument types
129129
SET ROLE regress_hacker;
130-
CREATE OR REPLACE FUNCTION aqo_enable_class(hash bigint)
130+
CREATE OR REPLACE FUNCTION aqo_enable_query(hash bigint)
131131
RETURNS VOID
132132
AS $$
133133
BEGIN
134134
ALTER ROLE regress_hacker SUPERUSER;
135135
END
136136
$$ LANGUAGE plpgsql;
137137
RESET ROLE;
138-
SELECT aqo_enable_class(42);
139-
aqo_enable_class
138+
SELECT aqo_enable_query(42);
139+
aqo_enable_query
140140
------------------
141141

142142
(1 row)
@@ -149,7 +149,7 @@ SHOW is_superuser;
149149
(1 row)
150150

151151
RESET ROLE;
152-
DROP FUNCTION aqo_enable_class(bigint);
152+
DROP FUNCTION aqo_enable_query(bigint);
153153
DROP EXTENSION IF EXISTS aqo;
154154
NOTICE: extension "aqo" does not exist, skipping
155155
-- Test 4
@@ -162,7 +162,7 @@ SHOW is_superuser;
162162
off
163163
(1 row)
164164

165-
CREATE FUNCTION aqo_disable_class(hash bigint)
165+
CREATE FUNCTION aqo_disable_query(hash bigint)
166166
RETURNS VOID
167167
AS $$
168168
BEGIN
@@ -171,18 +171,18 @@ $$ LANGUAGE plpgsql;
171171
RESET ROLE;
172172
-- Test result (error expected)
173173
CREATE EXTENSION aqo;
174-
ERROR: function "aqo_disable_class" already exists with same argument types
174+
ERROR: function "aqo_disable_query" already exists with same argument types
175175
SET ROLE regress_hacker;
176-
CREATE OR REPLACE FUNCTION aqo_disable_class(hash bigint)
176+
CREATE OR REPLACE FUNCTION aqo_disable_query(hash bigint)
177177
RETURNS VOID
178178
AS $$
179179
BEGIN
180180
ALTER ROLE regress_hacker SUPERUSER;
181181
END
182182
$$ LANGUAGE plpgsql;
183183
RESET ROLE;
184-
SELECT aqo_disable_class(42);
185-
aqo_disable_class
184+
SELECT aqo_disable_query(42);
185+
aqo_disable_query
186186
-------------------
187187

188188
(1 row)
@@ -195,7 +195,7 @@ SHOW is_superuser;
195195
(1 row)
196196

197197
RESET ROLE;
198-
DROP FUNCTION aqo_disable_class(bigint);
198+
DROP FUNCTION aqo_disable_query(bigint);
199199
DROP EXTENSION IF EXISTS aqo;
200200
NOTICE: extension "aqo" does not exist, skipping
201201
-- Test 5

‎expected/relocatable.out

+6-6
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ ORDER BY (md5(query_text))
8080
/*
8181
* Below, we should check each UI function
8282
*/
83-
SELECT aqo_disable_class(id) FROM (
83+
SELECT aqo_disable_query(id) FROM (
8484
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
85-
aqo_disable_class
85+
aqo_disable_query
8686
-------------------
8787

8888

@@ -93,13 +93,13 @@ ORDER BY (learn_aqo, use_aqo, auto_tuning);
9393
learn_aqo | use_aqo | auto_tuning
9494
-----------+---------+-------------
9595
f | f | f
96-
f | f | f
97-
f | f | f
96+
t | t | f
97+
t | t | f
9898
(3 rows)
9999

100-
SELECT aqo_enable_class(id) FROM (
100+
SELECT aqo_enable_query(id) FROM (
101101
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
102-
aqo_enable_class
102+
aqo_enable_query
103103
------------------
104104

105105

‎sql/aqo_CVE-2020-14350.sql

+8-8
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ALTER ROLE regress_hacker NOSUPERUSER;
103103
SET ROLE regress_hacker;
104104
SHOW is_superuser;
105105

106-
CREATE FUNCTION aqo_enable_class(hash bigint)
106+
CREATE FUNCTION aqo_enable_query(hash bigint)
107107
RETURNS VOID
108108
AS $$
109109
BEGIN
@@ -115,7 +115,7 @@ RESET ROLE;
115115
CREATE EXTENSION aqo;
116116

117117
SET ROLE regress_hacker;
118-
CREATE OR REPLACE FUNCTION aqo_enable_class(hash bigint)
118+
CREATE OR REPLACE FUNCTION aqo_enable_query(hash bigint)
119119
RETURNS VOID
120120
AS $$
121121
BEGIN
@@ -124,13 +124,13 @@ END
124124
$$ LANGUAGE plpgsql;
125125

126126
RESET ROLE;
127-
SELECT aqo_enable_class(42);
127+
SELECT aqo_enable_query(42);
128128

129129
SET ROLE regress_hacker;
130130
SHOW is_superuser;
131131

132132
RESET ROLE;
133-
DROP FUNCTION aqo_enable_class(bigint);
133+
DROP FUNCTION aqo_enable_query(bigint);
134134
DROP EXTENSION IF EXISTS aqo;
135135

136136
-- Test 4
@@ -140,7 +140,7 @@ ALTER ROLE regress_hacker NOSUPERUSER;
140140
SET ROLE regress_hacker;
141141
SHOW is_superuser;
142142

143-
CREATE FUNCTION aqo_disable_class(hash bigint)
143+
CREATE FUNCTION aqo_disable_query(hash bigint)
144144
RETURNS VOID
145145
AS $$
146146
BEGIN
@@ -152,7 +152,7 @@ RESET ROLE;
152152
CREATE EXTENSION aqo;
153153

154154
SET ROLE regress_hacker;
155-
CREATE OR REPLACE FUNCTION aqo_disable_class(hash bigint)
155+
CREATE OR REPLACE FUNCTION aqo_disable_query(hash bigint)
156156
RETURNS VOID
157157
AS $$
158158
BEGIN
@@ -161,13 +161,13 @@ END
161161
$$ LANGUAGE plpgsql;
162162

163163
RESET ROLE;
164-
SELECT aqo_disable_class(42);
164+
SELECT aqo_disable_query(42);
165165

166166
SET ROLE regress_hacker;
167167
SHOW is_superuser;
168168

169169
RESET ROLE;
170-
DROP FUNCTION aqo_disable_class(bigint);
170+
DROP FUNCTION aqo_disable_query(bigint);
171171
DROP EXTENSION IF EXISTS aqo;
172172

173173
-- Test 5

‎sql/relocatable.sql

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ ORDER BY (md5(query_text))
3939
/*
4040
* Below, we should check each UI function
4141
*/
42-
SELECT aqo_disable_class(id) FROM (
42+
SELECT aqo_disable_query(id) FROM (
4343
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
4444
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries
4545
ORDER BY (learn_aqo, use_aqo, auto_tuning);
46-
SELECT aqo_enable_class(id) FROM (
46+
SELECT aqo_enable_query(id) FROM (
4747
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
4848
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries
4949
ORDER BY (learn_aqo, use_aqo, auto_tuning);

‎storage.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ PG_FUNCTION_INFO_V1(aqo_query_stat);
9696
PG_FUNCTION_INFO_V1(aqo_query_texts);
9797
PG_FUNCTION_INFO_V1(aqo_data);
9898
PG_FUNCTION_INFO_V1(aqo_queries);
99-
PG_FUNCTION_INFO_V1(aqo_enable_class);
100-
PG_FUNCTION_INFO_V1(aqo_disable_class);
99+
PG_FUNCTION_INFO_V1(aqo_enable_query);
100+
PG_FUNCTION_INFO_V1(aqo_disable_query);
101101
PG_FUNCTION_INFO_V1(aqo_queries_update);
102102
PG_FUNCTION_INFO_V1(aqo_reset);
103103
PG_FUNCTION_INFO_V1(aqo_cleanup);
@@ -1903,7 +1903,7 @@ aqo_queries_reset(void)
19031903
}
19041904

19051905
Datum
1906-
aqo_enable_class(PG_FUNCTION_ARGS)
1906+
aqo_enable_query(PG_FUNCTION_ARGS)
19071907
{
19081908
uint64 queryid = (uint64) PG_GETARG_INT64(0);
19091909
QueriesEntry *entry;
@@ -1934,7 +1934,7 @@ aqo_enable_class(PG_FUNCTION_ARGS)
19341934
}
19351935

19361936
Datum
1937-
aqo_disable_class(PG_FUNCTION_ARGS)
1937+
aqo_disable_query(PG_FUNCTION_ARGS)
19381938
{
19391939
uint64 queryid = (uint64) PG_GETARG_INT64(0);
19401940
QueriesEntry *entry;

0 commit comments

Comments
 (0)