timescaledb/sql/data_node.sql
Erik Nordström 9108ddad15 Fix corner cases when detaching data nodes
This change fixes the following:

* Refactor the code for setting the default data node for a chunk. The
  `set_chunk_default_data_node()` API function now takes a
  `regclass`/`oid` instead of separate schema + table names and
  returns `true` when a new data node is set and `false` if called
  with a data node that is already the default. Like before,
  exceptions are thrown on errors. It also does proper permissions
  checks. The related code has been moved from `data_node.c` to
  `chunk.c` since this is an operation on a chunk, and the code now
  also lives in the `tsl` directory since this is non-trivial logic
  that should fall under the TSL license.
* When setting the default data node on a chunk (failing over to
  another data node), it is now verified that the new data node
  actually has a replica of the chunk and that the corresponding
  foreign server belongs to the "right" foreign data wrapper.
* Error messages and permissions handling have been tweaked.
2020-05-27 17:31:09 +02:00

8 lines
363 B
SQL

-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
-- Check if a data node is up
CREATE FUNCTION _timescaledb_internal.ping_data_node(node_name NAME) RETURNS BOOLEAN
AS '@MODULE_PATHNAME@', 'ts_data_node_ping' LANGUAGE C VOLATILE;