timescaledb/sql/ddl_internal.sql
Amy Tai 83014ee2b0 Implement drop_chunks in C
Remove the existing PLPGSQL function that implements drop_chunks, replacing it with a direct call to the C function, which also implements the old PLPGSQL checks in C. Refactor out much of the code shared between the C implementations of show_chunks and drop_chunks.
2018-12-06 13:27:12 -05:00

20 lines
925 B
SQL

-- Copyright (c) 2016-2018 Timescale, Inc. All Rights Reserved.
--
-- This file is licensed under the Apache License, see LICENSE-APACHE
-- at the top level directory of the TimescaleDB distribution.
CREATE OR REPLACE FUNCTION _timescaledb_internal.drop_chunks_impl(
hypertable REGCLASS = NULL,
older_than "any" = NULL,
newer_than "any" = NULL,
cascade BOOLEAN = FALSE
) RETURNS VOID AS '@MODULE_PATHNAME@', 'ts_chunk_drop_chunks'
LANGUAGE C STABLE PARALLEL SAFE;
--documentation of these function located in chunk_index.h
CREATE OR REPLACE FUNCTION _timescaledb_internal.chunk_index_clone(chunk_index_oid OID) RETURNS OID
AS '@MODULE_PATHNAME@', 'ts_chunk_index_clone' LANGUAGE C VOLATILE STRICT;
CREATE OR REPLACE FUNCTION _timescaledb_internal.chunk_index_replace(chunk_index_oid_old OID, chunk_index_oid_new OID) RETURNS VOID
AS '@MODULE_PATHNAME@', 'ts_chunk_index_replace' LANGUAGE C VOLATILE STRICT;