/usr/share/postgresql/9.6/extension/citus--5.2-1--5.2-2.sql is in postgresql-9.6-citus 6.0.1.PGDG-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /* citus--5.2-1--5.2-2.sql */
CREATE OR REPLACE FUNCTION pg_catalog.citus_truncate_trigger()
RETURNS trigger
LANGUAGE plpgsql
SET search_path = 'pg_catalog'
AS $cdbtt$
DECLARE
partitionType char;
commandText text;
BEGIN
SELECT partmethod INTO partitionType
FROM pg_dist_partition WHERE logicalrelid = TG_RELID;
IF NOT FOUND THEN
RETURN NEW;
END IF;
IF (partitionType = 'a') THEN
PERFORM master_drop_all_shards(TG_RELID, TG_TABLE_SCHEMA, TG_TABLE_NAME);
ELSE
SELECT format('TRUNCATE TABLE %I.%I CASCADE', TG_TABLE_SCHEMA, TG_TABLE_NAME)
INTO commandText;
PERFORM master_modify_multiple_shards(commandText);
END IF;
RETURN NEW;
END;
$cdbtt$;
|