rename UDFs also

pull/4328/head
Jeff Davis 2020-11-19 12:27:40 -08:00
parent a2b698a766
commit 91015deb9d
14 changed files with 71 additions and 71 deletions

View File

@ -1266,11 +1266,11 @@ columnar_handler(PG_FUNCTION_ARGS)
/*
* alter_cstore_table_set is a UDF exposed in postgres to change settings on a columnar
* alter_columnar_table_set is a UDF exposed in postgres to change settings on a columnar
* table. Calling this function on a non-columnar table gives an error.
*
* sql syntax:
* pg_catalog.alter_cstore_table_set(
* pg_catalog.alter_columnar_table_set(
* table_name regclass,
* block_row_count int DEFAULT NULL,
* stripe_row_count int DEFAULT NULL,
@ -1278,16 +1278,16 @@ columnar_handler(PG_FUNCTION_ARGS)
*
* All arguments except the table name are optional. The UDF is supposed to be called
* like:
* SELECT alter_cstore_table_set('table', compression => 'pglz');
* SELECT alter_columnar_table_set('table', compression => 'pglz');
*
* This will only update the compression of the table, keeping all other settings the
* same. Multiple settings can be changed at the same time by providing multiple
* arguments. Calling the argument with the NULL value will be interperted as not having
* provided the argument.
*/
PG_FUNCTION_INFO_V1(alter_cstore_table_set);
PG_FUNCTION_INFO_V1(alter_columnar_table_set);
Datum
alter_cstore_table_set(PG_FUNCTION_ARGS)
alter_columnar_table_set(PG_FUNCTION_ARGS)
{
Oid relationId = PG_GETARG_OID(0);
@ -1340,9 +1340,9 @@ alter_cstore_table_set(PG_FUNCTION_ARGS)
}
PG_FUNCTION_INFO_V1(alter_cstore_table_reset);
PG_FUNCTION_INFO_V1(alter_columnar_table_reset);
Datum
alter_cstore_table_reset(PG_FUNCTION_ARGS)
alter_columnar_table_reset(PG_FUNCTION_ARGS)
{
Oid relationId = PG_GETARG_OID(0);

View File

@ -96,8 +96,8 @@ BEGIN
IF substring(current_Setting('server_version'), '\d+')::int >= 12 THEN
EXECUTE $$
#include "udfs/columnar_handler/10.0-1.sql"
#include "udfs/alter_cstore_table_set/10.0-1.sql"
#include "udfs/alter_cstore_table_reset/10.0-1.sql"
#include "udfs/alter_columnar_table_set/10.0-1.sql"
#include "udfs/alter_columnar_table_reset/10.0-1.sql"
$$;
END IF;
END$proc$;

View File

@ -1,13 +1,13 @@
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_reset(
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_reset(
table_name regclass,
block_row_count bool DEFAULT false,
stripe_row_count bool DEFAULT false,
compression bool DEFAULT false)
RETURNS void
LANGUAGE C
AS 'MODULE_PATHNAME', 'alter_cstore_table_reset';
AS 'MODULE_PATHNAME', 'alter_columnar_table_reset';
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_reset(
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_reset(
table_name regclass,
block_row_count bool,
stripe_row_count bool,

View File

@ -1,13 +1,13 @@
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_reset(
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_reset(
table_name regclass,
block_row_count bool DEFAULT false,
stripe_row_count bool DEFAULT false,
compression bool DEFAULT false)
RETURNS void
LANGUAGE C
AS 'MODULE_PATHNAME', 'alter_cstore_table_reset';
AS 'MODULE_PATHNAME', 'alter_columnar_table_reset';
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_reset(
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_reset(
table_name regclass,
block_row_count bool,
stripe_row_count bool,

View File

@ -1,13 +1,13 @@
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_set(
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_set(
table_name regclass,
block_row_count int DEFAULT NULL,
stripe_row_count int DEFAULT NULL,
compression name DEFAULT null)
RETURNS void
LANGUAGE C
AS 'MODULE_PATHNAME', 'alter_cstore_table_set';
AS 'MODULE_PATHNAME', 'alter_columnar_table_set';
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_set(
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_set(
table_name regclass,
block_row_count int,
stripe_row_count int,

View File

@ -1,13 +1,13 @@
CREATE OR REPLACE FUNCTION pg_catalog.alter_cstore_table_set(
CREATE OR REPLACE FUNCTION pg_catalog.alter_columnar_table_set(
table_name regclass,
block_row_count int DEFAULT NULL,
stripe_row_count int DEFAULT NULL,
compression name DEFAULT null)
RETURNS void
LANGUAGE C
AS 'MODULE_PATHNAME', 'alter_cstore_table_set';
AS 'MODULE_PATHNAME', 'alter_columnar_table_set';
COMMENT ON FUNCTION pg_catalog.alter_cstore_table_set(
COMMENT ON FUNCTION pg_catalog.alter_columnar_table_set(
table_name regclass,
block_row_count int,
stripe_row_count int,

View File

@ -20,9 +20,9 @@ IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
#include "../columnar_handler/10.0-1.sql"
#include "../alter_cstore_table_set/10.0-1.sql"
#include "../alter_columnar_table_set/10.0-1.sql"
#include "../alter_cstore_table_reset/10.0-1.sql"
#include "../alter_columnar_table_reset/10.0-1.sql"
-- add the missing objects to the extension
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);

View File

@ -20,9 +20,9 @@ IF NOT EXISTS (SELECT 1 FROM pg_am WHERE amname = 'columnar') THEN
#include "../columnar_handler/10.0-1.sql"
#include "../alter_cstore_table_set/10.0-1.sql"
#include "../alter_columnar_table_set/10.0-1.sql"
#include "../alter_cstore_table_reset/10.0-1.sql"
#include "../alter_columnar_table_reset/10.0-1.sql"
-- add the missing objects to the extension
ALTER EXTENSION citus ADD FUNCTION cstore.columnar_handler(internal);

View File

@ -11,8 +11,8 @@ WHERE regclass = 'table_options'::regclass;
(1 row)
-- test changing the compression
SELECT alter_cstore_table_set('table_options', compression => 'pglz');
alter_cstore_table_set
SELECT alter_columnar_table_set('table_options', compression => 'pglz');
alter_columnar_table_set
---------------------------------------------------------------------
(1 row)
@ -26,8 +26,8 @@ WHERE regclass = 'table_options'::regclass;
(1 row)
-- test changing the block_row_count
SELECT alter_cstore_table_set('table_options', block_row_count => 10);
alter_cstore_table_set
SELECT alter_columnar_table_set('table_options', block_row_count => 10);
alter_columnar_table_set
---------------------------------------------------------------------
(1 row)
@ -41,8 +41,8 @@ WHERE regclass = 'table_options'::regclass;
(1 row)
-- test changing the block_row_count
SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
alter_cstore_table_set
SELECT alter_columnar_table_set('table_options', stripe_row_count => 100);
alter_columnar_table_set
---------------------------------------------------------------------
(1 row)
@ -66,8 +66,8 @@ WHERE regclass = 'table_options'::regclass;
(1 row)
-- set all settings at the same time
SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
alter_cstore_table_set
SELECT alter_columnar_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
alter_columnar_table_set
---------------------------------------------------------------------
(1 row)
@ -93,8 +93,8 @@ WHERE regclass = 'table_options'::regclass;
table_options | 100 | 1000 | none
(1 row)
SELECT alter_cstore_table_reset('table_options', block_row_count => true);
alter_cstore_table_reset
SELECT alter_columnar_table_reset('table_options', block_row_count => true);
alter_columnar_table_reset
---------------------------------------------------------------------
(1 row)
@ -107,8 +107,8 @@ WHERE regclass = 'table_options'::regclass;
table_options | 1000 | 1000 | none
(1 row)
SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
alter_cstore_table_reset
SELECT alter_columnar_table_reset('table_options', stripe_row_count => true);
alter_columnar_table_reset
---------------------------------------------------------------------
(1 row)
@ -121,8 +121,8 @@ WHERE regclass = 'table_options'::regclass;
table_options | 1000 | 10000 | none
(1 row)
SELECT alter_cstore_table_reset('table_options', compression => true);
alter_cstore_table_reset
SELECT alter_columnar_table_reset('table_options', compression => true);
alter_columnar_table_reset
---------------------------------------------------------------------
(1 row)
@ -147,12 +147,12 @@ WHERE regclass = 'table_options'::regclass;
table_options | 1000 | 10000 | pglz
(1 row)
SELECT alter_cstore_table_reset(
SELECT alter_columnar_table_reset(
'table_options',
block_row_count => true,
stripe_row_count => true,
compression => true);
alter_cstore_table_reset
alter_columnar_table_reset
---------------------------------------------------------------------
(1 row)
@ -168,12 +168,12 @@ WHERE regclass = 'table_options'::regclass;
-- verify edge cases
-- first start with a table that is not a cstore table
CREATE TABLE not_a_cstore_table (a int);
SELECT alter_cstore_table_set('not_a_cstore_table', compression => 'pglz');
SELECT alter_columnar_table_set('not_a_cstore_table', compression => 'pglz');
ERROR: table not_a_cstore_table is not a cstore table
SELECT alter_cstore_table_reset('not_a_cstore_table', compression => true);
SELECT alter_columnar_table_reset('not_a_cstore_table', compression => true);
ERROR: table not_a_cstore_table is not a cstore table
-- verify you can't use a compression that is not known
SELECT alter_cstore_table_set('table_options', compression => 'foobar');
SELECT alter_columnar_table_set('table_options', compression => 'foobar');
ERROR: unknown compression type for cstore table: foobar
SET client_min_messages TO warning;
DROP SCHEMA am_tableoptions CASCADE;

View File

@ -36,8 +36,8 @@ SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.r
(1 row)
-- test the case when all data cannot fit into a single stripe
SELECT alter_cstore_table_set('t', stripe_row_count => 1000);
alter_cstore_table_set
SELECT alter_columnar_table_set('t', stripe_row_count => 1000);
alter_columnar_table_set
---------------------------------------------------------------------
(1 row)
@ -162,11 +162,11 @@ SELECT count(*) FROM t;
-- add some stripes with different compression types and create some gaps,
-- then vacuum to print stats
BEGIN;
SELECT alter_cstore_table_set('t',
SELECT alter_columnar_table_set('t',
block_row_count => 1000,
stripe_row_count => 2000,
compression => 'pglz');
alter_cstore_table_set
alter_columnar_table_set
---------------------------------------------------------------------
(1 row)
@ -175,8 +175,8 @@ SAVEPOINT s1;
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
ROLLBACK TO SAVEPOINT s1;
INSERT INTO t SELECT i / 5 FROM generate_series(1, 1500) i;
SELECT alter_cstore_table_set('t', compression => 'none');
alter_cstore_table_set
SELECT alter_columnar_table_set('t', compression => 'none');
alter_columnar_table_set
---------------------------------------------------------------------
(1 row)
@ -211,8 +211,8 @@ block count: 11, containing data for dropped columns: 2, none compressed: 9, pgl
-- vacuum full should remove blocks for dropped columns
-- note that, a block will be stored in non-compressed for if compression
-- doesn't reduce its size.
SELECT alter_cstore_table_set('t', compression => 'pglz');
alter_cstore_table_set
SELECT alter_columnar_table_set('t', compression => 'pglz');
alter_columnar_table_set
---------------------------------------------------------------------
(1 row)

View File

@ -480,8 +480,8 @@ SELECT * FROM print_extension_changes();
| access method columnar
| event trigger cstore_ddl_event_end
| foreign-data wrapper cstore_fdw
| function alter_cstore_table_reset(regclass,boolean,boolean,boolean)
| function alter_cstore_table_set(regclass,integer,integer,name)
| function alter_columnar_table_reset(regclass,boolean,boolean,boolean)
| function alter_columnar_table_set(regclass,integer,integer,name)
| function citus_internal.cstore_ensure_objects_exist()
| function cstore.cstore_ddl_event_end_trigger()
| function cstore.cstore_fdw_handler()

View File

@ -20,8 +20,8 @@ ORDER BY 1;
event trigger citus_cascade_to_partition
event trigger cstore_ddl_event_end
foreign-data wrapper cstore_fdw
function alter_cstore_table_reset(regclass,boolean,boolean,boolean)
function alter_cstore_table_set(regclass,integer,integer,name)
function alter_columnar_table_reset(regclass,boolean,boolean,boolean)
function alter_columnar_table_set(regclass,integer,integer,name)
function alter_role_if_exists(text,text)
function any_value(anyelement)
function any_value_agg(anyelement,anyelement)

View File

@ -9,21 +9,21 @@ SELECT * FROM cstore.columnar_options
WHERE regclass = 'table_options'::regclass;
-- test changing the compression
SELECT alter_cstore_table_set('table_options', compression => 'pglz');
SELECT alter_columnar_table_set('table_options', compression => 'pglz');
-- show table_options settings
SELECT * FROM cstore.columnar_options
WHERE regclass = 'table_options'::regclass;
-- test changing the block_row_count
SELECT alter_cstore_table_set('table_options', block_row_count => 10);
SELECT alter_columnar_table_set('table_options', block_row_count => 10);
-- show table_options settings
SELECT * FROM cstore.columnar_options
WHERE regclass = 'table_options'::regclass;
-- test changing the block_row_count
SELECT alter_cstore_table_set('table_options', stripe_row_count => 100);
SELECT alter_columnar_table_set('table_options', stripe_row_count => 100);
-- show table_options settings
SELECT * FROM cstore.columnar_options
@ -37,7 +37,7 @@ SELECT * FROM cstore.columnar_options
WHERE regclass = 'table_options'::regclass;
-- set all settings at the same time
SELECT alter_cstore_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
SELECT alter_columnar_table_set('table_options', stripe_row_count => 1000, block_row_count => 100, compression => 'none');
-- show table_options settings
SELECT * FROM cstore.columnar_options
@ -53,18 +53,18 @@ SET cstore.compression TO 'pglz';
SELECT * FROM cstore.columnar_options
WHERE regclass = 'table_options'::regclass;
SELECT alter_cstore_table_reset('table_options', block_row_count => true);
SELECT alter_columnar_table_reset('table_options', block_row_count => true);
-- show table_options settings
SELECT * FROM cstore.columnar_options
WHERE regclass = 'table_options'::regclass;
SELECT alter_cstore_table_reset('table_options', stripe_row_count => true);
SELECT alter_columnar_table_reset('table_options', stripe_row_count => true);
-- show table_options settings
SELECT * FROM cstore.columnar_options
WHERE regclass = 'table_options'::regclass;
SELECT alter_cstore_table_reset('table_options', compression => true);
SELECT alter_columnar_table_reset('table_options', compression => true);
-- show table_options settings
SELECT * FROM cstore.columnar_options
@ -79,7 +79,7 @@ SET cstore.compression TO 'none';
SELECT * FROM cstore.columnar_options
WHERE regclass = 'table_options'::regclass;
SELECT alter_cstore_table_reset(
SELECT alter_columnar_table_reset(
'table_options',
block_row_count => true,
stripe_row_count => true,
@ -92,11 +92,11 @@ WHERE regclass = 'table_options'::regclass;
-- verify edge cases
-- first start with a table that is not a cstore table
CREATE TABLE not_a_cstore_table (a int);
SELECT alter_cstore_table_set('not_a_cstore_table', compression => 'pglz');
SELECT alter_cstore_table_reset('not_a_cstore_table', compression => true);
SELECT alter_columnar_table_set('not_a_cstore_table', compression => 'pglz');
SELECT alter_columnar_table_reset('not_a_cstore_table', compression => true);
-- verify you can't use a compression that is not known
SELECT alter_cstore_table_set('table_options', compression => 'foobar');
SELECT alter_columnar_table_set('table_options', compression => 'foobar');
SET client_min_messages TO warning;
DROP SCHEMA am_tableoptions CASCADE;

View File

@ -18,7 +18,7 @@ SELECT sum(a), sum(b) FROM t;
SELECT count(*) FROM cstore.cstore_stripes a, pg_class b WHERE a.relfilenode=b.relfilenode AND b.relname='t';
-- test the case when all data cannot fit into a single stripe
SELECT alter_cstore_table_set('t', stripe_row_count => 1000);
SELECT alter_columnar_table_set('t', stripe_row_count => 1000);
INSERT INTO t SELECT i, 2 * i FROM generate_series(1,2500) i;
SELECT sum(a), sum(b) FROM t;
@ -65,7 +65,7 @@ SELECT count(*) FROM t;
-- then vacuum to print stats
BEGIN;
SELECT alter_cstore_table_set('t',
SELECT alter_columnar_table_set('t',
block_row_count => 1000,
stripe_row_count => 2000,
compression => 'pglz');
@ -73,7 +73,7 @@ SAVEPOINT s1;
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
ROLLBACK TO SAVEPOINT s1;
INSERT INTO t SELECT i / 5 FROM generate_series(1, 1500) i;
SELECT alter_cstore_table_set('t', compression => 'none');
SELECT alter_columnar_table_set('t', compression => 'none');
SAVEPOINT s2;
INSERT INTO t SELECT i FROM generate_series(1, 1500) i;
ROLLBACK TO SAVEPOINT s2;
@ -94,7 +94,7 @@ VACUUM VERBOSE t;
-- vacuum full should remove blocks for dropped columns
-- note that, a block will be stored in non-compressed for if compression
-- doesn't reduce its size.
SELECT alter_cstore_table_set('t', compression => 'pglz');
SELECT alter_columnar_table_set('t', compression => 'pglz');
VACUUM FULL t;
VACUUM VERBOSE t;