Fix DROP replay of functions with no parameters.
authorPetr Jelinek <petr@2ndquadrant.com>
Wed, 17 Jun 2015 17:45:19 +0000 (19:45 +0200)
committerPetr Jelinek <petr@2ndquadrant.com>
Wed, 17 Jun 2015 17:45:31 +0000 (19:45 +0200)
bdr_apply.c
expected/ddl/function.out
expected/ddl/namespace.out
sql/ddl/namespace.sql

index 8a9c05b202cd74c44a909df0ad49b9e5158e8ddf..18f65afee70a370fbb37f4b2839e99f5866b2468 100644 (file)
@@ -1752,10 +1752,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
            {
@@ -1814,6 +1815,7 @@ process_queued_drop(HeapTuple cmdtup)
 
        addr = get_object_address(objtype, objnames, objargs, &objrel,
                                  AccessExclusiveLock, false);
+
        /* unsupported object? */
        if (addr.classId == InvalidOid)
            continue;
index 389587554d9443b814d0709b9dc682922abacf41..16fb3eb98fe6c225c8aab772ba420e044d821d63 100644 (file)
@@ -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)
 
index d4705e440eb1f5bfcc0c0ca8471a16b31c611ac3..efe5bcf0693fc4dd77c367dfd36aeb6fd147d73f 100644 (file)
@@ -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 
 ---------------------------
index af5ce43af97f8422170ab6480376e9ee00af52e4..93ddff3d55ca06cc3b6daa9f5567d7efb92b6b8d 100644 (file)
@@ -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 =