timescaledb/sql/errors.sql
Matvey Arye bfe58b61f7 Refactor towards supporting version upgrades
Clean up the table schema to get rid of legacy tables and functionality
that makes it more difficult to provide an upgrade path.

Notable changes:
* Get rid of legacy tables and code
* Simplify directory structure for SQL code
* Simplify table hierarchy: remove root table and make chunk tables
* inherit directly from main table
* Change chunk table suffix from _data to _chunk
* Simplify schema usage: _timescaledb_internal for internal functions.
* _timescaledb_catalog for metadata tables.
* Remove postgres_fdw dependency
* Improve code comments in sql code
2017-06-08 13:55:05 -04:00

25 lines
649 B
PL/PgSQL

-- Error codes defined in errors.h
-- The functions in this file are just utility commands for throwing common errors.
CREATE OR REPLACE FUNCTION _timescaledb_internal.on_trigger_error(
tg_op TEXT,
tg_schema NAME,
tg_table NAME
)
RETURNS VOID LANGUAGE PLPGSQL AS
$BODY$
BEGIN
RAISE EXCEPTION 'Operation % not supported on %.%', tg_op, tg_schema, tg_table
USING ERRCODE = 'IO101';
END
$BODY$;
CREATE OR REPLACE FUNCTION _timescaledb_internal.on_truncate_block()
RETURNS TRIGGER LANGUAGE PLPGSQL AS
$BODY$
BEGIN
PERFORM _timescaledb_internal.on_trigger_error(TG_OP, TG_TABLE_SCHEMA, TG_TABLE_NAME);
END
$BODY$;