Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions aqo--1.4--1.5.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ CREATE VIEW aqo_queries AS SELECT * FROM aqo_queries();
/* UI functions */


CREATE FUNCTION aqo_enable_class(queryid bigint)
CREATE FUNCTION aqo_enable_query(queryid bigint)
RETURNS void
AS 'MODULE_PATHNAME', 'aqo_enable_class'
AS 'MODULE_PATHNAME', 'aqo_enable_query'
LANGUAGE C STRICT VOLATILE;

CREATE FUNCTION aqo_disable_class(queryid bigint)
CREATE FUNCTION aqo_disable_query(queryid bigint)
RETURNS void
AS 'MODULE_PATHNAME', 'aqo_disable_class'
AS 'MODULE_PATHNAME', 'aqo_enable_query'
LANGUAGE C STRICT VOLATILE;

CREATE FUNCTION aqo_queries_update(
Expand Down
24 changes: 12 additions & 12 deletions expected/aqo_CVE-2020-14350.out
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ SHOW is_superuser;
off
(1 row)

CREATE FUNCTION aqo_enable_class(hash bigint)
CREATE FUNCTION aqo_enable_query(hash bigint)
RETURNS VOID
AS $$
BEGIN
Expand All @@ -125,18 +125,18 @@ $$ LANGUAGE plpgsql;
RESET ROLE;
-- Test result (error expected)
CREATE EXTENSION aqo;
ERROR: function "aqo_enable_class" already exists with same argument types
ERROR: function "aqo_enable_query" already exists with same argument types
SET ROLE regress_hacker;
CREATE OR REPLACE FUNCTION aqo_enable_class(hash bigint)
CREATE OR REPLACE FUNCTION aqo_enable_query(hash bigint)
RETURNS VOID
AS $$
BEGIN
ALTER ROLE regress_hacker SUPERUSER;
END
$$ LANGUAGE plpgsql;
RESET ROLE;
SELECT aqo_enable_class(42);
aqo_enable_class
SELECT aqo_enable_query(42);
aqo_enable_query
------------------

(1 row)
Expand All @@ -149,7 +149,7 @@ SHOW is_superuser;
(1 row)

RESET ROLE;
DROP FUNCTION aqo_enable_class(bigint);
DROP FUNCTION aqo_enable_query(bigint);
DROP EXTENSION IF EXISTS aqo;
NOTICE: extension "aqo" does not exist, skipping
-- Test 4
Expand All @@ -162,7 +162,7 @@ SHOW is_superuser;
off
(1 row)

CREATE FUNCTION aqo_disable_class(hash bigint)
CREATE FUNCTION aqo_disable_query(hash bigint)
RETURNS VOID
AS $$
BEGIN
Expand All @@ -171,18 +171,18 @@ $$ LANGUAGE plpgsql;
RESET ROLE;
-- Test result (error expected)
CREATE EXTENSION aqo;
ERROR: function "aqo_disable_class" already exists with same argument types
ERROR: function "aqo_disable_query" already exists with same argument types
SET ROLE regress_hacker;
CREATE OR REPLACE FUNCTION aqo_disable_class(hash bigint)
CREATE OR REPLACE FUNCTION aqo_disable_query(hash bigint)
RETURNS VOID
AS $$
BEGIN
ALTER ROLE regress_hacker SUPERUSER;
END
$$ LANGUAGE plpgsql;
RESET ROLE;
SELECT aqo_disable_class(42);
aqo_disable_class
SELECT aqo_disable_query(42);
aqo_disable_query
-------------------

(1 row)
Expand All @@ -195,7 +195,7 @@ SHOW is_superuser;
(1 row)

RESET ROLE;
DROP FUNCTION aqo_disable_class(bigint);
DROP FUNCTION aqo_disable_query(bigint);
DROP EXTENSION IF EXISTS aqo;
NOTICE: extension "aqo" does not exist, skipping
-- Test 5
Expand Down
12 changes: 6 additions & 6 deletions expected/relocatable.out
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ ORDER BY (md5(query_text))
/*
* Below, we should check each UI function
*/
SELECT aqo_disable_class(id) FROM (
SELECT aqo_disable_query(id) FROM (
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
aqo_disable_class
aqo_disable_query
-------------------


Expand All @@ -93,13 +93,13 @@ ORDER BY (learn_aqo, use_aqo, auto_tuning);
learn_aqo | use_aqo | auto_tuning
-----------+---------+-------------
f | f | f
f | f | f
f | f | f
t | t | f
t | t | f
(3 rows)

SELECT aqo_enable_class(id) FROM (
SELECT aqo_enable_query(id) FROM (
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
aqo_enable_class
aqo_enable_query
------------------


Expand Down
16 changes: 8 additions & 8 deletions sql/aqo_CVE-2020-14350.sql
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ ALTER ROLE regress_hacker NOSUPERUSER;
SET ROLE regress_hacker;
SHOW is_superuser;

CREATE FUNCTION aqo_enable_class(hash bigint)
CREATE FUNCTION aqo_enable_query(hash bigint)
RETURNS VOID
AS $$
BEGIN
Expand All @@ -115,7 +115,7 @@ RESET ROLE;
CREATE EXTENSION aqo;

SET ROLE regress_hacker;
CREATE OR REPLACE FUNCTION aqo_enable_class(hash bigint)
CREATE OR REPLACE FUNCTION aqo_enable_query(hash bigint)
RETURNS VOID
AS $$
BEGIN
Expand All @@ -124,13 +124,13 @@ END
$$ LANGUAGE plpgsql;

RESET ROLE;
SELECT aqo_enable_class(42);
SELECT aqo_enable_query(42);

SET ROLE regress_hacker;
SHOW is_superuser;

RESET ROLE;
DROP FUNCTION aqo_enable_class(bigint);
DROP FUNCTION aqo_enable_query(bigint);
DROP EXTENSION IF EXISTS aqo;

-- Test 4
Expand All @@ -140,7 +140,7 @@ ALTER ROLE regress_hacker NOSUPERUSER;
SET ROLE regress_hacker;
SHOW is_superuser;

CREATE FUNCTION aqo_disable_class(hash bigint)
CREATE FUNCTION aqo_disable_query(hash bigint)
RETURNS VOID
AS $$
BEGIN
Expand All @@ -152,7 +152,7 @@ RESET ROLE;
CREATE EXTENSION aqo;

SET ROLE regress_hacker;
CREATE OR REPLACE FUNCTION aqo_disable_class(hash bigint)
CREATE OR REPLACE FUNCTION aqo_disable_query(hash bigint)
RETURNS VOID
AS $$
BEGIN
Expand All @@ -161,13 +161,13 @@ END
$$ LANGUAGE plpgsql;

RESET ROLE;
SELECT aqo_disable_class(42);
SELECT aqo_disable_query(42);

SET ROLE regress_hacker;
SHOW is_superuser;

RESET ROLE;
DROP FUNCTION aqo_disable_class(bigint);
DROP FUNCTION aqo_disable_query(bigint);
DROP EXTENSION IF EXISTS aqo;

-- Test 5
Expand Down
4 changes: 2 additions & 2 deletions sql/relocatable.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ ORDER BY (md5(query_text))
/*
* Below, we should check each UI function
*/
SELECT aqo_disable_class(id) FROM (
SELECT aqo_disable_query(id) FROM (
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries
ORDER BY (learn_aqo, use_aqo, auto_tuning);
SELECT aqo_enable_class(id) FROM (
SELECT aqo_enable_query(id) FROM (
SELECT queryid AS id FROM aqo_queries WHERE queryid <> 0) AS q1;
SELECT learn_aqo, use_aqo, auto_tuning FROM test.aqo_queries
ORDER BY (learn_aqo, use_aqo, auto_tuning);
Expand Down
8 changes: 4 additions & 4 deletions storage.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ PG_FUNCTION_INFO_V1(aqo_query_stat);
PG_FUNCTION_INFO_V1(aqo_query_texts);
PG_FUNCTION_INFO_V1(aqo_data);
PG_FUNCTION_INFO_V1(aqo_queries);
PG_FUNCTION_INFO_V1(aqo_enable_class);
PG_FUNCTION_INFO_V1(aqo_disable_class);
PG_FUNCTION_INFO_V1(aqo_enable_query);
PG_FUNCTION_INFO_V1(aqo_disable_query);
PG_FUNCTION_INFO_V1(aqo_queries_update);
PG_FUNCTION_INFO_V1(aqo_reset);
PG_FUNCTION_INFO_V1(aqo_cleanup);
Expand Down Expand Up @@ -1903,7 +1903,7 @@ aqo_queries_reset(void)
}

Datum
aqo_enable_class(PG_FUNCTION_ARGS)
aqo_enable_query(PG_FUNCTION_ARGS)
{
uint64 queryid = (uint64) PG_GETARG_INT64(0);
QueriesEntry *entry;
Expand Down Expand Up @@ -1934,7 +1934,7 @@ aqo_enable_class(PG_FUNCTION_ARGS)
}

Datum
aqo_disable_class(PG_FUNCTION_ARGS)
aqo_disable_query(PG_FUNCTION_ARGS)
{
uint64 queryid = (uint64) PG_GETARG_INT64(0);
QueriesEntry *entry;
Expand Down