Skip to content

Commit f097d8b

Browse files
committed
Change names of interface functions for better usage
1 parent 2498f3d commit f097d8b

File tree

6 files changed

+37
-36
lines changed

6 files changed

+37
-36
lines changed

‎aqo--1.4--1.5.sql

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ DROP TABLE public.aqo_data CASCADE;
1919
DROP TABLE public.aqo_queries CASCADE;
2020
DROP TABLE public.aqo_query_texts CASCADE;
2121
DROP TABLE public.aqo_query_stat CASCADE;
22+
DROP FUNCTION invalidate_deactivated_queries_cache;
2223

2324

2425
/*
@@ -76,14 +77,14 @@ CREATE VIEW aqo_queries AS SELECT * FROM aqo_queries();
7677
/* UI functions */
7778

7879

79-
CREATE FUNCTION aqo_enable_query(queryid bigint)
80+
CREATE FUNCTION aqo_enable_class(queryid bigint)
8081
RETURNS void
81-
AS 'MODULE_PATHNAME', 'aqo_enable_query'
82+
AS 'MODULE_PATHNAME', 'aqo_enable_class'
8283
LANGUAGE C STRICT VOLATILE;
8384

84-
CREATE FUNCTION aqo_disable_query(queryid bigint)
85+
CREATE FUNCTION aqo_disable_class(queryid bigint)
8586
RETURNS void
86-
AS 'MODULE_PATHNAME', 'aqo_enable_query'
87+
AS 'MODULE_PATHNAME', 'aqo_disable_class'
8788
LANGUAGE C STRICT VOLATILE;
8889

8990
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_query(hash bigint)
119+
CREATE FUNCTION aqo_enable_class(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_query" already exists with same argument types
128+
ERROR: function "aqo_enable_class" already exists with same argument types
129129
SET ROLE regress_hacker;
130-
CREATE OR REPLACE FUNCTION aqo_enable_query(hash bigint)
130+
CREATE OR REPLACE FUNCTION aqo_enable_class(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_query(42);
139-
aqo_enable_query
138+
SELECT aqo_enable_class(42);
139+
aqo_enable_class
140140
------------------
141141

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

151151
RESET ROLE;
152-
DROP FUNCTION aqo_enable_query(bigint);
152+
DROP FUNCTION aqo_enable_class(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_query(hash bigint)
165+
CREATE FUNCTION aqo_disable_class(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_query" already exists with same argument types
174+
ERROR: function "aqo_disable_class" already exists with same argument types
175175
SET ROLE regress_hacker;
176-
CREATE OR REPLACE FUNCTION aqo_disable_query(hash bigint)
176+
CREATE OR REPLACE FUNCTION aqo_disable_class(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_query(42);
185-
aqo_disable_query
184+
SELECT aqo_disable_class(42);
185+
aqo_disable_class
186186
-------------------
187187

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

197197
RESET ROLE;
198-
DROP FUNCTION aqo_disable_query(bigint);
198+
DROP FUNCTION aqo_disable_class(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_query(id) FROM (
83+
SELECT aqo_disable_class(id) FROM (
8484
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
85-
aqo_disable_query
85+
aqo_disable_class
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-
t | t | f
97-
t | t | f
96+
f | f | f
97+
f | f | f
9898
(3 rows)
9999

100-
SELECT aqo_enable_query(id) FROM (
100+
SELECT aqo_enable_class(id) FROM (
101101
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
102-
aqo_enable_query
102+
aqo_enable_class
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_query(hash bigint)
106+
CREATE FUNCTION aqo_enable_class(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_query(hash bigint)
118+
CREATE OR REPLACE FUNCTION aqo_enable_class(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_query(42);
127+
SELECT aqo_enable_class(42);
128128

129129
SET ROLE regress_hacker;
130130
SHOW is_superuser;
131131

132132
RESET ROLE;
133-
DROP FUNCTION aqo_enable_query(bigint);
133+
DROP FUNCTION aqo_enable_class(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_query(hash bigint)
143+
CREATE FUNCTION aqo_disable_class(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_query(hash bigint)
155+
CREATE OR REPLACE FUNCTION aqo_disable_class(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_query(42);
164+
SELECT aqo_disable_class(42);
165165

166166
SET ROLE regress_hacker;
167167
SHOW is_superuser;
168168

169169
RESET ROLE;
170-
DROP FUNCTION aqo_disable_query(bigint);
170+
DROP FUNCTION aqo_disable_class(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_query(id) FROM (
42+
SELECT aqo_disable_class(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_query(id) FROM (
46+
SELECT aqo_enable_class(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_query);
100-
PG_FUNCTION_INFO_V1(aqo_disable_query);
99+
PG_FUNCTION_INFO_V1(aqo_enable_class);
100+
PG_FUNCTION_INFO_V1(aqo_disable_class);
101101
PG_FUNCTION_INFO_V1(aqo_queries_update);
102102
PG_FUNCTION_INFO_V1(aqo_reset);
103103
PG_FUNCTION_INFO_V1(aqo_cleanup);
@@ -1904,7 +1904,7 @@ aqo_queries_reset(void)
19041904
}
19051905

19061906
Datum
1907-
aqo_enable_query(PG_FUNCTION_ARGS)
1907+
aqo_enable_class(PG_FUNCTION_ARGS)
19081908
{
19091909
uint64 queryid = (uint64) PG_GETARG_INT64(0);
19101910
QueriesEntry *entry;
@@ -1935,7 +1935,7 @@ aqo_enable_query(PG_FUNCTION_ARGS)
19351935
}
19361936

19371937
Datum
1938-
aqo_disable_query(PG_FUNCTION_ARGS)
1938+
aqo_disable_class(PG_FUNCTION_ARGS)
19391939
{
19401940
uint64 queryid = (uint64) PG_GETARG_INT64(0);
19411941
QueriesEntry *entry;

0 commit comments

Comments
 (0)