mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-19 20:24:46 +08:00
Move type support functions into _timescaledb_functions schema
This commit is contained in:
parent
2d7eb18f24
commit
0595ff0888
@ -14,29 +14,29 @@
|
|||||||
-- validation constraint for columns of type ts_interval.
|
-- validation constraint for columns of type ts_interval.
|
||||||
|
|
||||||
--the textual input/output is simply base64 encoding of the binary representation
|
--the textual input/output is simply base64 encoding of the binary representation
|
||||||
CREATE OR REPLACE FUNCTION _timescaledb_internal.compressed_data_in(CSTRING)
|
CREATE OR REPLACE FUNCTION _timescaledb_functions.compressed_data_in(CSTRING)
|
||||||
RETURNS _timescaledb_internal.compressed_data
|
RETURNS _timescaledb_internal.compressed_data
|
||||||
AS '@MODULE_PATHNAME@', 'ts_compressed_data_in'
|
AS '@MODULE_PATHNAME@', 'ts_compressed_data_in'
|
||||||
LANGUAGE C IMMUTABLE STRICT;
|
LANGUAGE C IMMUTABLE STRICT;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION _timescaledb_internal.compressed_data_out(_timescaledb_internal.compressed_data)
|
CREATE OR REPLACE FUNCTION _timescaledb_functions.compressed_data_out(_timescaledb_internal.compressed_data)
|
||||||
RETURNS CSTRING
|
RETURNS CSTRING
|
||||||
AS '@MODULE_PATHNAME@', 'ts_compressed_data_out'
|
AS '@MODULE_PATHNAME@', 'ts_compressed_data_out'
|
||||||
LANGUAGE C IMMUTABLE STRICT;
|
LANGUAGE C IMMUTABLE STRICT;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION _timescaledb_internal.compressed_data_send(_timescaledb_internal.compressed_data)
|
CREATE OR REPLACE FUNCTION _timescaledb_functions.compressed_data_send(_timescaledb_internal.compressed_data)
|
||||||
RETURNS BYTEA
|
RETURNS BYTEA
|
||||||
AS '@MODULE_PATHNAME@', 'ts_compressed_data_send'
|
AS '@MODULE_PATHNAME@', 'ts_compressed_data_send'
|
||||||
LANGUAGE C IMMUTABLE STRICT;
|
LANGUAGE C IMMUTABLE STRICT;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION _timescaledb_internal.compressed_data_recv(internal)
|
CREATE OR REPLACE FUNCTION _timescaledb_functions.compressed_data_recv(internal)
|
||||||
RETURNS _timescaledb_internal.compressed_data
|
RETURNS _timescaledb_internal.compressed_data
|
||||||
AS '@MODULE_PATHNAME@', 'ts_compressed_data_recv'
|
AS '@MODULE_PATHNAME@', 'ts_compressed_data_recv'
|
||||||
LANGUAGE C IMMUTABLE STRICT;
|
LANGUAGE C IMMUTABLE STRICT;
|
||||||
|
|
||||||
-- Remote transation ID implementation
|
-- Remote transation ID implementation
|
||||||
CREATE OR REPLACE FUNCTION _timescaledb_internal.rxid_in(cstring) RETURNS @extschema@.rxid
|
CREATE OR REPLACE FUNCTION _timescaledb_functions.rxid_in(cstring) RETURNS @extschema@.rxid
|
||||||
AS '@MODULE_PATHNAME@', 'ts_remote_txn_id_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
AS '@MODULE_PATHNAME@', 'ts_remote_txn_id_in' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
||||||
|
|
||||||
CREATE OR REPLACE FUNCTION _timescaledb_internal.rxid_out(@extschema@.rxid) RETURNS cstring
|
CREATE OR REPLACE FUNCTION _timescaledb_functions.rxid_out(@extschema@.rxid) RETURNS cstring
|
||||||
AS '@MODULE_PATHNAME@', 'ts_remote_txn_id_out' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
AS '@MODULE_PATHNAME@', 'ts_remote_txn_id_out' LANGUAGE C IMMUTABLE STRICT PARALLEL SAFE;
|
||||||
|
@ -9,10 +9,10 @@ CREATE TYPE _timescaledb_internal.compressed_data (
|
|||||||
INTERNALLENGTH = VARIABLE,
|
INTERNALLENGTH = VARIABLE,
|
||||||
STORAGE = EXTERNAL,
|
STORAGE = EXTERNAL,
|
||||||
ALIGNMENT = double, --needed for alignment in ARRAY type compression
|
ALIGNMENT = double, --needed for alignment in ARRAY type compression
|
||||||
INPUT = _timescaledb_internal.compressed_data_in,
|
INPUT = _timescaledb_functions.compressed_data_in,
|
||||||
OUTPUT = _timescaledb_internal.compressed_data_out,
|
OUTPUT = _timescaledb_functions.compressed_data_out,
|
||||||
RECEIVE = _timescaledb_internal.compressed_data_recv,
|
RECEIVE = _timescaledb_functions.compressed_data_recv,
|
||||||
SEND = _timescaledb_internal.compressed_data_send
|
SEND = _timescaledb_functions.compressed_data_send
|
||||||
);
|
);
|
||||||
|
|
||||||
--
|
--
|
||||||
@ -20,6 +20,6 @@ CREATE TYPE _timescaledb_internal.compressed_data (
|
|||||||
--
|
--
|
||||||
CREATE TYPE @extschema@.rxid (
|
CREATE TYPE @extschema@.rxid (
|
||||||
internallength = 16,
|
internallength = 16,
|
||||||
input = _timescaledb_internal.rxid_in,
|
input = _timescaledb_functions.rxid_in,
|
||||||
output = _timescaledb_internal.rxid_out
|
output = _timescaledb_functions.rxid_out
|
||||||
);
|
);
|
||||||
|
@ -50,3 +50,10 @@ DROP FUNCTION IF EXISTS _timescaledb_internal.hypertable_from_main_table(regclas
|
|||||||
DROP FUNCTION IF EXISTS _timescaledb_internal.main_table_from_hypertable(integer);
|
DROP FUNCTION IF EXISTS _timescaledb_internal.main_table_from_hypertable(integer);
|
||||||
DROP FUNCTION IF EXISTS _timescaledb_internal.time_literal_sql(bigint, regtype);
|
DROP FUNCTION IF EXISTS _timescaledb_internal.time_literal_sql(bigint, regtype);
|
||||||
|
|
||||||
|
ALTER FUNCTION _timescaledb_internal.compressed_data_in(CSTRING) SET SCHEMA _timescaledb_functions;
|
||||||
|
ALTER FUNCTION _timescaledb_internal.compressed_data_out(_timescaledb_internal.compressed_data) SET SCHEMA _timescaledb_functions;
|
||||||
|
ALTER FUNCTION _timescaledb_internal.compressed_data_send(_timescaledb_internal.compressed_data) SET SCHEMA _timescaledb_functions;
|
||||||
|
ALTER FUNCTION _timescaledb_internal.compressed_data_recv(internal) SET SCHEMA _timescaledb_functions;
|
||||||
|
|
||||||
|
ALTER FUNCTION _timescaledb_internal.rxid_in(cstring) SET SCHEMA _timescaledb_functions;
|
||||||
|
ALTER FUNCTION _timescaledb_internal.rxid_out(@extschema@.rxid) SET SCHEMA _timescaledb_functions;
|
||||||
|
@ -113,6 +113,14 @@ ALTER FUNCTION _timescaledb_functions.bookend_finalfunc(internal, anyelement, "a
|
|||||||
ALTER FUNCTION _timescaledb_functions.bookend_serializefunc(internal) SET SCHEMA _timescaledb_internal;
|
ALTER FUNCTION _timescaledb_functions.bookend_serializefunc(internal) SET SCHEMA _timescaledb_internal;
|
||||||
ALTER FUNCTION _timescaledb_functions.bookend_deserializefunc(bytea, internal) SET SCHEMA _timescaledb_internal;
|
ALTER FUNCTION _timescaledb_functions.bookend_deserializefunc(bytea, internal) SET SCHEMA _timescaledb_internal;
|
||||||
|
|
||||||
|
ALTER FUNCTION _timescaledb_functions.compressed_data_in(CSTRING) SET SCHEMA _timescaledb_internal;
|
||||||
|
ALTER FUNCTION _timescaledb_functions.compressed_data_out(_timescaledb_internal.compressed_data) SET SCHEMA _timescaledb_internal;
|
||||||
|
ALTER FUNCTION _timescaledb_functions.compressed_data_send(_timescaledb_internal.compressed_data) SET SCHEMA _timescaledb_internal;
|
||||||
|
ALTER FUNCTION _timescaledb_functions.compressed_data_recv(internal) SET SCHEMA _timescaledb_internal;
|
||||||
|
|
||||||
|
ALTER FUNCTION _timescaledb_functions.rxid_in(cstring) SET SCHEMA _timescaledb_internal;
|
||||||
|
ALTER FUNCTION _timescaledb_functions.rxid_out(@extschema@.rxid) SET SCHEMA _timescaledb_internal;
|
||||||
|
|
||||||
DROP SCHEMA _timescaledb_functions;
|
DROP SCHEMA _timescaledb_functions;
|
||||||
|
|
||||||
CREATE FUNCTION _timescaledb_internal.is_main_table(
|
CREATE FUNCTION _timescaledb_internal.is_main_table(
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
-- Please see the included NOTICE for copyright information and
|
-- Please see the included NOTICE for copyright information and
|
||||||
-- LICENSE-TIMESCALE for a copy of the license.
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||||
CREATE FUNCTION _timescaledb_internal.test_remote_txn_id()
|
CREATE FUNCTION _timescaledb_functions.test_remote_txn_id()
|
||||||
RETURNS void
|
RETURNS void
|
||||||
AS :TSL_MODULE_PATHNAME, 'ts_test_remote_txn_id'
|
AS :TSL_MODULE_PATHNAME, 'ts_test_remote_txn_id'
|
||||||
LANGUAGE C STRICT;
|
LANGUAGE C STRICT;
|
||||||
SELECT _timescaledb_internal.test_remote_txn_id();
|
SELECT _timescaledb_functions.test_remote_txn_id();
|
||||||
test_remote_txn_id
|
test_remote_txn_id
|
||||||
--------------------
|
--------------------
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ create table tbl_w_rxid(
|
|||||||
);
|
);
|
||||||
CREATE UNIQUE INDEX idx_name ON tbl_w_rxid ((txn_id::text));
|
CREATE UNIQUE INDEX idx_name ON tbl_w_rxid ((txn_id::text));
|
||||||
INSERT INTO tbl_w_rxid VALUES ('ts-1-10-20-30'), ('ts-1-11-20-30'), ('ts-1-10-21-30');
|
INSERT INTO tbl_w_rxid VALUES ('ts-1-10-20-30'), ('ts-1-11-20-30'), ('ts-1-10-21-30');
|
||||||
SELECT txn_id, _timescaledb_internal.rxid_in(_timescaledb_internal.rxid_out(txn_id))::text = txn_id::text FROM tbl_w_rxid;
|
SELECT txn_id, _timescaledb_functions.rxid_in(_timescaledb_functions.rxid_out(txn_id))::text = txn_id::text FROM tbl_w_rxid;
|
||||||
txn_id | ?column?
|
txn_id | ?column?
|
||||||
---------------+----------
|
---------------+----------
|
||||||
ts-1-10-20-30 | t
|
ts-1-10-20-30 | t
|
||||||
|
@ -22,6 +22,10 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text
|
|||||||
_timescaledb_functions.bookend_deserializefunc(bytea,internal)
|
_timescaledb_functions.bookend_deserializefunc(bytea,internal)
|
||||||
_timescaledb_functions.bookend_finalfunc(internal,anyelement,"any")
|
_timescaledb_functions.bookend_finalfunc(internal,anyelement,"any")
|
||||||
_timescaledb_functions.bookend_serializefunc(internal)
|
_timescaledb_functions.bookend_serializefunc(internal)
|
||||||
|
_timescaledb_functions.compressed_data_in(cstring)
|
||||||
|
_timescaledb_functions.compressed_data_out(_timescaledb_internal.compressed_data)
|
||||||
|
_timescaledb_functions.compressed_data_recv(internal)
|
||||||
|
_timescaledb_functions.compressed_data_send(_timescaledb_internal.compressed_data)
|
||||||
_timescaledb_functions.first_combinefunc(internal,internal)
|
_timescaledb_functions.first_combinefunc(internal,internal)
|
||||||
_timescaledb_functions.first_sfunc(internal,anyelement,"any")
|
_timescaledb_functions.first_sfunc(internal,anyelement,"any")
|
||||||
_timescaledb_functions.hist_combinefunc(internal,internal)
|
_timescaledb_functions.hist_combinefunc(internal,internal)
|
||||||
@ -31,6 +35,8 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text
|
|||||||
_timescaledb_functions.hist_sfunc(internal,double precision,double precision,double precision,integer)
|
_timescaledb_functions.hist_sfunc(internal,double precision,double precision,double precision,integer)
|
||||||
_timescaledb_functions.last_combinefunc(internal,internal)
|
_timescaledb_functions.last_combinefunc(internal,internal)
|
||||||
_timescaledb_functions.last_sfunc(internal,anyelement,"any")
|
_timescaledb_functions.last_sfunc(internal,anyelement,"any")
|
||||||
|
_timescaledb_functions.rxid_in(cstring)
|
||||||
|
_timescaledb_functions.rxid_out(rxid)
|
||||||
_timescaledb_internal.alter_job_set_hypertable_id(integer,regclass)
|
_timescaledb_internal.alter_job_set_hypertable_id(integer,regclass)
|
||||||
_timescaledb_internal.attach_osm_table_chunk(regclass,regclass)
|
_timescaledb_internal.attach_osm_table_chunk(regclass,regclass)
|
||||||
_timescaledb_internal.cagg_migrate_create_plan(_timescaledb_catalog.continuous_agg,text,boolean,boolean)
|
_timescaledb_internal.cagg_migrate_create_plan(_timescaledb_catalog.continuous_agg,text,boolean,boolean)
|
||||||
@ -59,10 +65,6 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text
|
|||||||
_timescaledb_internal.chunks_remote_size(name,name)
|
_timescaledb_internal.chunks_remote_size(name,name)
|
||||||
_timescaledb_internal.compressed_chunk_local_stats(name,name)
|
_timescaledb_internal.compressed_chunk_local_stats(name,name)
|
||||||
_timescaledb_internal.compressed_chunk_remote_stats(name,name)
|
_timescaledb_internal.compressed_chunk_remote_stats(name,name)
|
||||||
_timescaledb_internal.compressed_data_in(cstring)
|
|
||||||
_timescaledb_internal.compressed_data_out(_timescaledb_internal.compressed_data)
|
|
||||||
_timescaledb_internal.compressed_data_recv(internal)
|
|
||||||
_timescaledb_internal.compressed_data_send(_timescaledb_internal.compressed_data)
|
|
||||||
_timescaledb_internal.continuous_agg_invalidation_trigger()
|
_timescaledb_internal.continuous_agg_invalidation_trigger()
|
||||||
_timescaledb_internal.create_chunk(regclass,jsonb,name,name,regclass)
|
_timescaledb_internal.create_chunk(regclass,jsonb,name,name,regclass)
|
||||||
_timescaledb_internal.create_chunk_replica_table(regclass,name)
|
_timescaledb_internal.create_chunk_replica_table(regclass,name)
|
||||||
@ -126,8 +128,6 @@ ORDER BY pronamespace::regnamespace::text COLLATE "C", p.oid::regprocedure::text
|
|||||||
_timescaledb_internal.relation_size(regclass)
|
_timescaledb_internal.relation_size(regclass)
|
||||||
_timescaledb_internal.remote_txn_heal_data_node(oid)
|
_timescaledb_internal.remote_txn_heal_data_node(oid)
|
||||||
_timescaledb_internal.restart_background_workers()
|
_timescaledb_internal.restart_background_workers()
|
||||||
_timescaledb_internal.rxid_in(cstring)
|
|
||||||
_timescaledb_internal.rxid_out(rxid)
|
|
||||||
_timescaledb_internal.set_chunk_default_data_node(regclass,name)
|
_timescaledb_internal.set_chunk_default_data_node(regclass,name)
|
||||||
_timescaledb_internal.set_dist_id(uuid)
|
_timescaledb_internal.set_dist_id(uuid)
|
||||||
_timescaledb_internal.set_peer_dist_id(uuid)
|
_timescaledb_internal.set_peer_dist_id(uuid)
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
-- LICENSE-TIMESCALE for a copy of the license.
|
-- LICENSE-TIMESCALE for a copy of the license.
|
||||||
|
|
||||||
\c :TEST_DBNAME :ROLE_SUPERUSER
|
\c :TEST_DBNAME :ROLE_SUPERUSER
|
||||||
CREATE FUNCTION _timescaledb_internal.test_remote_txn_id()
|
CREATE FUNCTION _timescaledb_functions.test_remote_txn_id()
|
||||||
RETURNS void
|
RETURNS void
|
||||||
AS :TSL_MODULE_PATHNAME, 'ts_test_remote_txn_id'
|
AS :TSL_MODULE_PATHNAME, 'ts_test_remote_txn_id'
|
||||||
LANGUAGE C STRICT;
|
LANGUAGE C STRICT;
|
||||||
|
|
||||||
SELECT _timescaledb_internal.test_remote_txn_id();
|
SELECT _timescaledb_functions.test_remote_txn_id();
|
||||||
|
|
||||||
SELECT 'ts-1-10-20-30'::rxid;
|
SELECT 'ts-1-10-20-30'::rxid;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ CREATE UNIQUE INDEX idx_name ON tbl_w_rxid ((txn_id::text));
|
|||||||
|
|
||||||
INSERT INTO tbl_w_rxid VALUES ('ts-1-10-20-30'), ('ts-1-11-20-30'), ('ts-1-10-21-30');
|
INSERT INTO tbl_w_rxid VALUES ('ts-1-10-20-30'), ('ts-1-11-20-30'), ('ts-1-10-21-30');
|
||||||
|
|
||||||
SELECT txn_id, _timescaledb_internal.rxid_in(_timescaledb_internal.rxid_out(txn_id))::text = txn_id::text FROM tbl_w_rxid;
|
SELECT txn_id, _timescaledb_functions.rxid_in(_timescaledb_functions.rxid_out(txn_id))::text = txn_id::text FROM tbl_w_rxid;
|
||||||
|
|
||||||
\set ON_ERROR_STOP 0
|
\set ON_ERROR_STOP 0
|
||||||
INSERT INTO tbl_w_rxid VALUES ('ts-1-10-20-30');
|
INSERT INTO tbl_w_rxid VALUES ('ts-1-10-20-30');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user