From e622b2ceaf638cf5e14151152fa32b89cab1dd24 Mon Sep 17 00:00:00 2001 From: Petr Jelinek Date: Wed, 17 Jun 2015 19:45:19 +0200 Subject: [PATCH] Fix DROP replay of functions with no parameters. --- bdr_apply.c | 8 +++++--- expected/ddl/function.out | 12 ++++-------- expected/ddl/namespace.out | 5 ++++- sql/ddl/namespace.sql | 3 +++ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/bdr_apply.c b/bdr_apply.c index fef9926f63..7afd66099f 100644 --- a/bdr_apply.c +++ b/bdr_apply.c @@ -1735,10 +1735,11 @@ process_queued_drop(HeapTuple cmdtup) datum = heap_getattr(&tmptup, 3, elemdesc, &isnull); if (isnull) { - elog(WARNING, "null typename !?"); - - if (objtype != OBJECT_AGGREGATE) + if (objtype == OBJECT_OPERATOR) + { + elog(WARNING, "null typename !?"); continue; + } } else { @@ -1797,6 +1798,7 @@ process_queued_drop(HeapTuple cmdtup) addr = get_object_address(objtype, objnames, objargs, &objrel, AccessExclusiveLock, false); + /* unsupported object? */ if (addr.classId == InvalidOid) continue; diff --git a/expected/ddl/function.out b/expected/ddl/function.out index 389587554d..16fb3eb98f 100644 --- a/expected/ddl/function.out +++ b/expected/ddl/function.out @@ -417,12 +417,8 @@ SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_r \c postgres \d+ test_trigger_table \df+ test_trigger_fn - List of functions - Schema | Name | Result data type | Argument data types | Type | Security | Volatility | Owner | Language | Source code | Description ---------+-----------------+------------------+---------------------+---------+----------+------------+-------+----------+-------------+------------- - public | test_trigger_fn | trigger | | trigger | invoker | volatile | super | plpgsql | +| - | | | | | | | | | BEGIN +| - | | | | | | | | | END; +| - | | | | | | | | | | -(1 row) + List of functions + Schema | Name | Result data type | Argument data types | Type | Security | Volatility | Owner | Language | Source code | Description +--------+------+------------------+---------------------+------+----------+------------+-------+----------+-------------+------------- +(0 rows) diff --git a/expected/ddl/namespace.out b/expected/ddl/namespace.out index d4705e440e..efe5bcf069 100644 --- a/expected/ddl/namespace.out +++ b/expected/ddl/namespace.out @@ -7,6 +7,8 @@ CREATE SCHEMA test_schema_1 a serial, b int UNIQUE ); +CREATE FUNCTION test_schema_1.abc_func() RETURNS void + AS $$ BEGIN END; $$ LANGUAGE plpgsql; SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; pg_xlog_wait_remote_apply --------------------------- @@ -70,9 +72,10 @@ ERROR: schema "test_schema_renamed" already exists CREATE SCHEMA IF NOT EXISTS test_schema_renamed; -- ok with notice NOTICE: schema "test_schema_renamed" already exists, skipping DROP SCHEMA test_schema_renamed CASCADE; -NOTICE: drop cascades to 2 other objects +NOTICE: drop cascades to 3 other objects DETAIL: drop cascades to table test_schema_renamed.abc drop cascades to view test_schema_renamed.abc_view +drop cascades to function test_schema_renamed.abc_func() SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; pg_xlog_wait_remote_apply --------------------------- diff --git a/sql/ddl/namespace.sql b/sql/ddl/namespace.sql index af5ce43af9..93ddff3d55 100644 --- a/sql/ddl/namespace.sql +++ b/sql/ddl/namespace.sql @@ -10,6 +10,9 @@ CREATE SCHEMA test_schema_1 b int UNIQUE ); +CREATE FUNCTION test_schema_1.abc_func() RETURNS void + AS $$ BEGIN END; $$ LANGUAGE plpgsql; + SELECT pg_xlog_wait_remote_apply(pg_current_xlog_location(), pid) FROM pg_stat_replication; \c regression SELECT COUNT(*) FROM pg_class WHERE relnamespace = -- 2.39.5