[pgpool-general: 5447] schema name in black_function_list pgpool version 3.4.3

Madhusudan, Dhanya dhanya.madhusudan at hpe.com
Wed May 10 19:56:31 JST 2017


Hi,

Is it possible to black_list all the functions under a schema?
For eg., We have update functions under the partman schema. To avoid them from being load-balanced, I added the below config, but I still get the below error in logs:
black_function_list = 'partman.*,currval, iot.contentinstance, ........'

2017-05-10 02:06:10 UTC edbrepuser postgres 15.213.55.240(39504)LOG:  disconnection: session time: 0:00:00.005 user=edbrepuser database=postgres host=15.213.55.240 port=39504
2017-05-10 02:06:11 UTC enterprisedb hp_iot 15.213.55.240(38428)ERROR:  cannot execute INSERT in a read-only transaction
2017-05-10 02:06:11 UTC enterprisedb hp_iot 15.213.55.240(38428)CONTEXT:  SQL statement "WITH partition_data AS (
                                DELETE FROM ONLY iot.contentinstance WHERE container_serial_id >= 3000 AND container_serial_id < 4000 RETURNING *)
                            INSERT INTO iot.contentinstance_p3000 SELECT * FROM partition_data"
        PL/pgSQL function partman.partition_data_id(text,integer,integer,numeric,text) line 104 at EXECUTE
2017-05-10 02:06:11 UTC enterprisedb hp_iot 15.213.55.240(38428)STATEMENT:  select partman.partition_data_id('iot.contentinstance', 100) as r
2017-05-10 02:06:11 UTC enterprisedb hp_iot 15.213.55.240(38428)ERROR:  cannot execute CREATE FUNCTION in a read-only transaction
        CONTEXT: SQL statement "CREATE OR REPLACE FUNCTION iot.request_part_trig_func() RETURNS trigger LANGUAGE plpgsql AS $t$
                    DECLARE
                    v_count                 int;
                           v_partition_name        text;
                    v_partition_timestamp   timestamptz;
                BEGIN
                IF TG_OP = 'INSERT' THEN
                    v_partition_timestamp := date_trunc('day', NEW.originating_timestamp);
                    IF NEW.originating_timestamp >= '2017-05-10 00:00:00+05:30' AND NEW.originating_timestamp < '2017-05-11 00:00:00+05:30' THEN
                        INSERT INTO iot.request_p2017_05_10 VALUES (NEW.*);
                    ELSIF NEW.originating_timestamp >= '2017-05-09 00:00:00+05:30' AND NEW.originating_timestamp < '2017-05-10 00:00:00+05:30' THEN
                        INSERT INTO iot.request_p2017_05_09 VALUES (NEW.*);
                    ELSIF NEW.originating_timestamp >= '2017-05-11 00:00:00+05:30' AND NEW.originating_timestamp < '2017-05-12 00:00:00+05:30' THEN
                        INSERT INTO iot.request_p2017_05_11 VALUES (NEW.*);
                    ELSIF NEW.originating_timestamp >= '2017-05-08 00:00:00+05:30' AND NEW.originating_timestamp < '2017-05-09 00:00:00+05:30' THEN
                        INSERT INTO iot.request_p2017_05_08 VALUES (NEW.*);
                    ELSIF NEW.originating_timestamp >= '2017-05-12 00:00:00+05:30' AND NEW.originating_timestamp < '2017-05-13 00:00:00+05:30' THEN
                        INSERT INTO iot.request_p2017_05_12 VALUES (NEW.*);
                    ELSIF NEW.originating_timestamp >= '2017-05-13 00:00:00+05:30' AND NEW.originating_timestamp < '2017-05-14 00:00:00+05:30' THEN
                        INSERT INTO iot.request_p2017_05_13 VALUES (NEW.*);
                    ELSE
                        v_partition_name := partman.check_name_length('request', to_char(v_partition_timestamp, 'YYYY_MM_DD'), TRUE);
                        SELECT count(*) INTO v_count FROM pg_catalog.pg_tables WHERE schemaname = 'iot'::name AND tablename = v_partition_name::name;
                        IF v_count > 0 THEN
                            EXECUTE format('INSERT INTO %I.%I VALUES($1.*)', 'iot', v_partition_name) USING NEW;
                        ELSE
                            RETURN NEW;
                        END IF;
                    END IF;
                END IF;
                RETURN NULL;
                EXCEPTION WHEN OTHERS THEN
                    RAISE WARNING 'pg_partman insert into child table failed, row inserted into parent (%.%). ERROR: %', TG_TABLE_SCHEMA, TG_TABLE_NAME, COALESCE(SQLERRM, 'unknown');
                    RETURN NEW;
                END $t$;"
        PL/pgSQL function partman.create_function_time(text,bigint) line 269 at EXECUTE
        SQL statement "SELECT partman.create_function_time(p_parent_table)"
        PL/pgSQL function partman.partition_data_time(text,integer,interval,numeric,text) line 226 at PERFORM
        DETAIL:
        HINT:
2017-05-10 02:06:11 UTC enterprisedb hp_iot 15.213.55.240(38428)CONTEXT:  SQL statement "SELECT partman.create_function_time(p_parent_table)"
        PL/pgSQL function partman.partition_data_time(text,integer,interval,numeric,text) line 226 at PERFORM


Regards,
Dhanya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.sraoss.jp/pipermail/pgpool-general/attachments/20170510/9fe5a2c9/attachment.html>


More information about the pgpool-general mailing list