 *   create_member_1n_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb) RETURNS TEXT
 *   create_member_nm_array_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb', OUT vars TEXT, OUT ref_block TEXT) RETURNS RECORD
 *   create_member_nm_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb', OUT vars TEXT, OUT ref_block TEXT) RETURNS RECORD
-*   create_ref_array_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS TEXT
-*   create_ref_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS TEXT
-*   create_ref_to_array_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS TEXT
-*   create_ref_to_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS TEXT
+*   create_ref_array_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb', 
+*     OUT args TEXT, OUT vars TEXT, OUT child_ref_block TEXT, OUT ref_block TEXT) RETURNS RECORD
+*   create_ref_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb',
+*     OUT args TEXT, OUT vars TEXT, OUT child_ref_block TEXT, OUT ref_block TEXT) RETURNS TEXT
+*   create_ref_to_array_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb',
+*     OUT vars TEXT, OUT returning_block TEXT, OUT collect_block TEXT, OUT into_block TEXT, OUT fk_block TEXT) RETURNS RECORD
+*   create_ref_to_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb',
+*     OUT vars TEXT, OUT returning_block TEXT, OUT into_block TEXT, OUT fk_block TEXT) RETURNS RECORD
 *   create_ref_to_parent_array_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS TEXT
 *   create_ref_to_parent_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS TEXT
-*   create_selfref_array_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS TEXT
+*   create_selfref_array_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb', has_objclass_param BOOLEAN DEFAULT FALSE) RETURNS TEXT
 *   create_selfref_delete(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS TEXT
 *   generate_delete_by_id_stmt(table_name TEXT) RETURNS TEXT
 *   generate_delete_by_ids_stmt(table_name TEXT) RETURNS TEXT

*
* FUNCTIONS:
*   check_for_cleanup(ref_table OID) RETURNS OID
*   create_array_delete_dummy(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS SETOF VOID
*   create_array_delete_function(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS SETOF VOID
*   create_array_delete_member_fct(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS SETOF VOID
*   create_delete_function(table_name TEXT, schema_name TEXT DEFAULT 'citydb') RETURNS SETOF VOID

  LOOP
    IF vars IS NULL THEN
      vars := '';
      child_ref_block := '';
      ref_block := '';
    END IF;

    IF (
