Index: openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses-plsql.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses-plsql.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses-plsql.sql 20 Jan 2021 21:01:03 -0000 1.2 +++ openacs-4/packages/contacts-lite/sql/postgresql/cn-addresses-plsql.sql 20 Jan 2021 21:07:14 -0000 1.3 @@ -2,49 +2,57 @@ select acs_object_type__drop_type('cn_address', TRUE); -create function inline_0 () -returns integer as ' -begin +CREATE OR REPLACE FUNCTION inline_0 () RETURNS integer AS $$ +BEGIN PERFORM acs_object_type__create_type ( - ''cn_address'', -- object_type - ''Address'', -- pretty_name - ''Addresses'', -- pretty_plural - ''acs_object'', -- supertype - ''cn_addresses'', -- table_name - ''address_id'', -- id_column + 'cn_address', -- object_type + 'Address', -- pretty_name + 'Addresses', -- pretty_plural + 'acs_object', -- supertype + 'cn_addresses', -- table_name + 'address_id', -- id_column null, -- package_name - ''f'', -- abstract_p + 'f', -- abstract_p null, -- type_extension_table null -- name_method ); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select inline_0 (); drop function inline_0 (); -create or replace function cn_address__new (integer,integer, integer, varchar, varchar, varchar, varchar,varchar, - integer,varchar, integer) -returns integer as ' -declare - p_address_id alias for $1; - p_address_type_id alias for $2; -- default - p_contact_id alias for $3; -- default - p_delivery_address alias for $4; -- default - p_municipality alias for $5; -- default null - p_postal_code alias for $6; -- default null - p_region alias for $7; -- default null - p_country_code alias for $8; - p_creation_user alias for $9; - p_creation_ip alias for $10; - p_context_id alias for $11; + + +-- added +select define_function_args('cn_address__new','address_id,address_type_id,contact_id,delivery_address,municipality;null,postal_code;null,region;null,country_code,creation_user,creation_ip,context_id'); + +-- +-- procedure cn_address__new/11 +-- +CREATE OR REPLACE FUNCTION cn_address__new( + p_address_id integer, + p_address_type_id integer, -- default + p_contact_id integer, -- default + p_delivery_address varchar, -- default + p_municipality varchar, -- default null + p_postal_code varchar, -- default null + p_region varchar, -- default null + p_country_code varchar, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE v_address_id cn_addresses.address_id%TYPE; -begin +BEGIN v_address_id := acs_object__new ( p_address_id, - ''cn_address'', + 'cn_address', now(), p_creation_user, p_creation_ip, @@ -60,33 +68,39 @@ PERFORM acs_permission__grant_permission ( v_address_id, p_creation_user, - ''admin'' + 'admin' ); return v_address_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function cn_address__new (integer, integer, varchar, varchar, varchar, varchar,varchar, - integer,varchar, integer) -returns integer as ' -declare - p_address_type_id alias for $1; -- default - p_contact_id alias for $2; -- default - p_delivery_address alias for $3; -- default - p_municipality alias for $4; -- default null - p_postal_code alias for $5; -- default null - p_region alias for $6; -- default null - p_country_code alias for $7; - p_creation_user alias for $8; - p_creation_ip alias for $9; - p_context_id alias for $10; + +-- +-- procedure cn_address__new/10 +-- +CREATE OR REPLACE FUNCTION cn_address__new( + p_address_type_id integer, -- default + p_contact_id integer, -- default + p_delivery_address varchar, -- default + p_municipality varchar, -- default null + p_postal_code varchar, -- default null + p_region varchar, -- default null + p_country_code varchar, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE + v_address_id cn_addresses.address_id%TYPE; -begin +BEGIN v_address_id := acs_object__new ( null, - ''cn_address'', + 'cn_address', now(), p_creation_user, p_creation_ip, @@ -102,12 +116,13 @@ PERFORM acs_permission__grant_permission ( v_address_id, p_creation_user, - ''admin'' + 'admin' ); return v_address_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; create or replace function cn_address__del (integer) returns integer as ' @@ -127,19 +142,28 @@ end;' language 'plpgsql'; -create or replace function cn_address__set (integer, integer, integer, varchar, varchar, varchar, varchar,varchar) -returns integer as ' -declare - p_address_id alias for $1; -- default - p_address_type_id alias for $2; -- default - p_contact_id alias for $3; -- default - p_delivery_address alias for $4; -- default - p_municipality alias for $5; -- default null - p_postal_code alias for $6; -- default null - p_region alias for $7; -- default null - p_country_code alias for $8; + + +-- added +select define_function_args('cn_address__set','address_id,address_type_id,contact_id,delivery_address,municipality;null,postal_code;null,region;null,country_code'); + +-- +-- procedure cn_address__set/8 +-- +CREATE OR REPLACE FUNCTION cn_address__set( + p_address_id integer, -- default + p_address_type_id integer, -- default + p_contact_id integer, -- default + p_delivery_address varchar, -- default + p_municipality varchar, -- default null + p_postal_code varchar, -- default null + p_region varchar, -- default null + p_country_code varchar + +) RETURNS integer AS $$ +DECLARE v_return integer := 0; -begin +BEGIN if p_address_type_id is not null then @@ -184,7 +208,8 @@ end if; return v_return; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/contacts-lite/sql/postgresql/cn-phones-plsql.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/cn-phones-plsql.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts-lite/sql/postgresql/cn-phones-plsql.sql 20 Jan 2021 21:01:03 -0000 1.2 +++ openacs-4/packages/contacts-lite/sql/postgresql/cn-phones-plsql.sql 20 Jan 2021 21:07:14 -0000 1.3 @@ -2,45 +2,54 @@ select acs_object_type__drop_type('cn_phone_number', TRUE); -create function inline_0 () -returns integer as ' -begin +CREATE OR REPLACE FUNCTION inline_0 () RETURNS integer AS $$ +BEGIN PERFORM acs_object_type__create_type ( - ''cn_phone_number'', -- object_type - ''Phone Number'', -- pretty_name - ''Phone Numbers'', -- pretty_plural - ''acs_object'', -- supertype - ''cn_phone_numbers'', -- table_name - ''phone_number_id'', -- id_column - ''cn_phone_number'', -- package_name - ''f'', -- abstract_p + 'cn_phone_number', -- object_type + 'Phone Number', -- pretty_name + 'Phone Numbers', -- pretty_plural + 'acs_object', -- supertype + 'cn_phone_numbers', -- table_name + 'phone_number_id', -- id_column + 'cn_phone_number', -- package_name + 'f', -- abstract_p null, -- type_extension_table null -- name_method ); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select inline_0 (); drop function inline_0 (); -create or replace function cn_phone_number__new (integer, varchar, integer, integer,varchar,integer,varchar,integer) -returns integer as ' -declare - p_contact_id alias for $1; -- default - p_phone_number alias for $2; -- default - p_phone_number_id alias for $3; -- default - p_phone_type_id alias for $4; -- default - p_best_contact_time alias for $5; - p_creation_user alias for $6; - p_creation_ip alias for $7; - p_context_id alias for $8; + + +-- added +select define_function_args('cn_phone_number__new','contact_id,phone_number,phone_number_id,phone_type_id,best_contact_time,creation_user,creation_ip,context_id'); + +-- +-- procedure cn_phone_number__new/8 +-- +CREATE OR REPLACE FUNCTION cn_phone_number__new( + p_contact_id integer, -- default + p_phone_number varchar, -- default + p_phone_number_id integer, -- default + p_phone_type_id integer, -- default + p_best_contact_time varchar, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE v_phone_number_id cn_phone_numbers.phone_number_id%TYPE; -begin +BEGIN v_phone_number_id := acs_object__new ( null, - ''cn_phone_number'', + 'cn_phone_number', now(), p_creation_user, p_creation_ip, @@ -55,44 +64,63 @@ PERFORM acs_permission__grant_permission ( v_phone_number_id, p_creation_user, - ''admin'' + 'admin' ); return v_phone_number_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function cn_phone_number__del (integer) -returns integer as ' -declare - p_phone_number_id alias for $1; + + +-- added +select define_function_args('cn_phone_number__del','phone_number_id'); + +-- +-- procedure cn_phone_number__del/1 +-- +CREATE OR REPLACE FUNCTION cn_phone_number__del( + p_phone_number_id integer +) RETURNS integer AS $$ +DECLARE v_return integer := 0; -begin +BEGIN delete from acs_permissions where object_id = p_phone_number_id; delete from cn_phone_numbers where phone_number_id = p_phone_number_id; - raise NOTICE ''Deleting cn_phone_number...''; + raise NOTICE 'Deleting cn_phone_number...'; return v_return; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function cn_phone_number__set (integer, varchar, integer, integer, varchar) -returns integer as ' -declare - p_contact_id alias for $1; -- default - p_phone_number alias for $2; -- default - p_phone_number_id alias for $3; -- default - p_phone_type_id alias for $4; -- default - p_best_contact_time alias for $5; + + +-- added +select define_function_args('cn_phone_number__set','contact_id,phone_number,phone_number_id,phone_type_id,best_contact_time'); + +-- +-- procedure cn_phone_number__set/5 +-- +CREATE OR REPLACE FUNCTION cn_phone_number__set( + p_contact_id integer, -- default + p_phone_number varchar, -- default + p_phone_number_id integer, -- default + p_phone_type_id integer, -- default + p_best_contact_time varchar + +) RETURNS integer AS $$ +DECLARE v_return integer := 0; -begin +BEGIN if p_contact_id is not null then @@ -119,4 +147,5 @@ end if; return v_return; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/contacts-lite/sql/postgresql/contact-category.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/contact-category.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts-lite/sql/postgresql/contact-category.sql 20 Jan 2021 21:01:04 -0000 1.2 +++ openacs-4/packages/contacts-lite/sql/postgresql/contact-category.sql 20 Jan 2021 21:07:14 -0000 1.3 @@ -40,19 +40,27 @@ -- plsql -create or replace function contact_category__new (integer,varchar,integer,varchar,integer) -returns integer as ' -declare - p_category_id alias for $1; - p_category_name alias for $2; - p_creation_user alias for $3; - p_creation_ip alias for $4; - p_context_id alias for $5; + + +-- added +select define_function_args('contact_category__new','category_id,category_name,creation_user,creation_ip,context_id'); + +-- +-- procedure contact_category__new/5 +-- +CREATE OR REPLACE FUNCTION contact_category__new( + p_category_id integer, + p_category_name varchar, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer +) RETURNS integer AS $$ +DECLARE v_category_id integer; -begin +BEGIN v_category_id := acs_object__new ( p_category_id, - ''contact_category'', + 'contact_category', now(), p_creation_user, p_creation_ip, @@ -69,25 +77,35 @@ PERFORM acs_permission__grant_permission( v_category_id, p_creation_user, - ''admin'' + 'admin' ); -- return v_category_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function contact_category__del (integer) -returns integer as ' -declare - p_category_id alias for $1; -begin + + +-- added +select define_function_args('contact_category__del','category_id'); + +-- +-- procedure contact_category__del/1 +-- +CREATE OR REPLACE FUNCTION contact_category__del( + p_category_id integer +) RETURNS integer AS $$ +DECLARE +BEGIN delete from contact_categories where category_id = contact_category__del.p_category_id; perform acs_object__delete(p_category_id); return 0; -end; -' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; + Index: openacs-4/packages/contacts-lite/sql/postgresql/contacts-plsql.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/contacts-plsql.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/contacts-lite/sql/postgresql/contacts-plsql.sql 20 Jan 2021 21:01:04 -0000 1.2 +++ openacs-4/packages/contacts-lite/sql/postgresql/contacts-plsql.sql 20 Jan 2021 21:07:14 -0000 1.3 @@ -2,55 +2,63 @@ select acs_object_type__drop_type('contact', TRUE); -create function inline_0 () -returns integer as ' -begin +CREATE OR REPLACE FUNCTION inline_0 () RETURNS integer AS $$ +BEGIN PERFORM acs_object_type__create_type ( - ''contact'', -- object_type - ''Contact'', -- pretty_name - ''Contacts'', -- pretty_plural - ''acs_object'', -- supertype - ''contacts'', -- table_name - ''contact_id'', -- id_column + 'contact', -- object_type + 'Contact', -- pretty_name + 'Contacts', -- pretty_plural + 'acs_object', -- supertype + 'contacts', -- table_name + 'contact_id', -- id_column null, -- package_name - ''f'', -- abstract_p + 'f', -- abstract_p null, -- type_extension_table null -- name_method ); return 0; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; select inline_0 (); drop function inline_0 (); -create or replace function contact__new (varchar, varchar, varchar, varchar, varchar, - varchar, varchar, varchar, integer, integer, text, varchar, varchar, integer,varchar,integer,integer) -returns integer as ' -declare - p_affix alias for $1; -- default - p_given_name alias for $2; -- default - p_family_name alias for $3; -- default - p_middle_name alias for $4; -- default - p_suffix alias for $5; -- default - p_formatted_name alias for $6; -- default - p_preferred_given_name alias for $7; -- default - p_company_name alias for $8; -- default - p_company_type_id alias for $9; -- default - p_category_id alias for $10; -- default - p_notes alias for $11; -- default - p_email alias for $12; - p_title alias for $13; - p_creation_user alias for $14; - p_creation_ip alias for $15; - p_context_id alias for $16; - p_contact_id alias for $17; + + +-- added +select define_function_args('contact__new','affix,given_name,family_name,middle_name,suffix,formatted_name,preferred_given_name,company_name,company_type_id,category_id,notes,email,title,creation_user,creation_ip,context_id,contact_id'); + +-- +-- procedure contact__new/17 +-- +CREATE OR REPLACE FUNCTION contact__new( + p_affix varchar, -- default + p_given_name varchar, -- default + p_family_name varchar, -- default + p_middle_name varchar, -- default + p_suffix varchar, -- default + p_formatted_name varchar, -- default + p_preferred_given_name varchar, -- default + p_company_name varchar, -- default + p_company_type_id integer, -- default + p_category_id integer, -- default + p_notes text, -- default + p_email varchar, + p_title varchar, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer, + p_contact_id integer + +) RETURNS integer AS $$ +DECLARE v_contact_id contacts.contact_id%TYPE; -begin +BEGIN v_contact_id := acs_object__new ( p_contact_id, - ''contact'', + 'contact', now(), p_creation_user, p_creation_ip, @@ -71,43 +79,49 @@ PERFORM acs_permission__grant_permission ( v_contact_id, p_creation_user, - ''admin'' + 'admin' ); return v_contact_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -- need for non-complete import -create or replace function contact__new (varchar, varchar, varchar, varchar, - varchar, integer, integer,varchar, integer,varchar,integer) -returns integer as ' -declare - p_given_name alias for $1; -- default - p_family_name alias for $2; -- default - p_middle_name alias for $3; -- default - p_formatted_name alias for $4; -- default - p_company_name alias for $5; -- default - p_company_type_id alias for $6; -- default - p_category_id alias for $7; -- default - p_email alias for $8; - p_creation_user alias for $9; - p_creation_ip alias for $10; - p_context_id alias for $11; + +-- +-- procedure contact__new/11 +-- +CREATE OR REPLACE FUNCTION contact__new( + p_given_name varchar, -- default + p_family_name varchar, -- default + p_middle_name varchar, -- default + p_formatted_name varchar, -- default + p_company_name varchar, -- default + p_company_type_id integer, -- default + p_category_id integer, -- default + p_email varchar, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer + +) RETURNS integer AS $$ +DECLARE + v_contact_id contacts.contact_id%TYPE; v_formatted_name contacts.formatted_name%TYPE; -begin +BEGIN if p_formatted_name is null then - v_formatted_name := p_given_name || '' '' || p_family_name; + v_formatted_name := p_given_name || ' ' || p_family_name; else v_formatted_name := p_formatted_name; end if; v_contact_id := acs_object__new ( null, - ''contact'', + 'contact', now(), p_creation_user, p_creation_ip, @@ -118,50 +132,56 @@ (given_name, family_name, middle_name, formatted_name, preferred_given_name, company_name, company_type_id,email, category_id, contact_id) values - (p_given_name, p_family_name, p_middle_name,p_given_name || '' '' || p_family_name, + (p_given_name, p_family_name, p_middle_name,p_given_name || ' ' || p_family_name, p_given_name, p_company_name, p_company_type_id, p_email,p_category_id, v_contact_id); PERFORM acs_permission__grant_permission ( v_contact_id, p_creation_user, - ''admin'' + 'admin' ); return v_contact_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function contact__new (varchar, varchar, varchar, varchar, - varchar, integer, integer,varchar, integer,varchar,integer,integer) -returns integer as ' -declare - p_given_name alias for $1; -- default - p_family_name alias for $2; -- default - p_middle_name alias for $3; -- default - p_formatted_name alias for $4; -- default - p_company_name alias for $5; -- default - p_company_type_id alias for $6; -- default - p_category_id alias for $7; -- default - p_email alias for $8; - p_creation_user alias for $9; - p_creation_ip alias for $10; - p_context_id alias for $11; - p_contact_id alias for $12; + +-- +-- procedure contact__new/12 +-- +CREATE OR REPLACE FUNCTION contact__new( + p_given_name varchar, -- default + p_family_name varchar, -- default + p_middle_name varchar, -- default + p_formatted_name varchar, -- default + p_company_name varchar, -- default + p_company_type_id integer, -- default + p_category_id integer, -- default + p_email varchar, + p_creation_user integer, + p_creation_ip varchar, + p_context_id integer, + p_contact_id integer + +) RETURNS integer AS $$ +DECLARE + v_contact_id contacts.contact_id%TYPE; v_formatted_name contacts.formatted_name%TYPE; -begin +BEGIN if p_formatted_name is null then - v_formatted_name := p_given_name || '' '' || p_family_name; + v_formatted_name := p_given_name || ' ' || p_family_name; else v_formatted_name := p_formatted_name; end if; v_contact_id := acs_object__new ( p_contact_id, - ''contact'', + 'contact', now(), p_creation_user, p_creation_ip, @@ -172,60 +192,78 @@ (given_name, family_name, middle_name, formatted_name, preferred_given_name, company_name, company_type_id,email, category_id, contact_id) values - (p_given_name, p_family_name, p_middle_name,p_given_name || '' '' || p_family_name, + (p_given_name, p_family_name, p_middle_name,p_given_name || ' ' || p_family_name, p_given_name, p_company_name, p_company_type_id, p_email,p_category_id, v_contact_id); PERFORM acs_permission__grant_permission ( v_contact_id, p_creation_user, - ''admin'' + 'admin' ); return v_contact_id; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function contact__del (integer) -returns integer as ' -declare - p_contact_id alias for $1; + + +-- added +select define_function_args('contact__del','contact_id'); + +-- +-- procedure contact__del/1 +-- +CREATE OR REPLACE FUNCTION contact__del( + p_contact_id integer +) RETURNS integer AS $$ +DECLARE v_return integer := 0; -begin +BEGIN delete from acs_permissions where object_id = p_contact_id; delete from contacts where contact_id = p_contact_id; - raise NOTICE ''Deleting contact...''; + raise NOTICE 'Deleting contact...'; return v_return; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create or replace function contact__set (varchar, varchar, varchar, varchar, varchar, - varchar, varchar, varchar, integer, integer, text, varchar, varchar, integer) -returns integer as ' -declare - p_affix alias for $1; -- default - p_given_name alias for $2; -- default - p_family_name alias for $3; -- default - p_middle_name alias for $4; -- default - p_suffix alias for $5; -- default - p_formatted_name alias for $6; -- default - p_preferred_given_name alias for $7; -- default - p_company_name alias for $8; -- default - p_company_type_id alias for $9; -- default - p_category_id alias for $10; -- default - p_notes alias for $11; -- default - p_email alias for $12; - p_title alias for $13; - p_contact_id alias for $14; -- default + + +-- added +select define_function_args('contact__set','affix,given_name,family_name,middle_name,suffix,formatted_name,preferred_given_name,company_name,company_type_id,category_id,notes,email,title,contact_id'); + +-- +-- procedure contact__set/14 +-- +CREATE OR REPLACE FUNCTION contact__set( + p_affix varchar, -- default + p_given_name varchar, -- default + p_family_name varchar, -- default + p_middle_name varchar, -- default + p_suffix varchar, -- default + p_formatted_name varchar, -- default + p_preferred_given_name varchar, -- default + p_company_name varchar, -- default + p_company_type_id integer, -- default + p_category_id integer, -- default + p_notes text, -- default + p_email varchar, + p_title varchar, + p_contact_id integer -- default + +) RETURNS integer AS $$ +DECLARE v_return integer := 0; -begin +BEGIN update contacts set family_name = p_family_name, @@ -243,9 +281,10 @@ notes = p_notes where contact_id = p_contact_id; - raise NOTICE ''Updating Contacts''; + raise NOTICE 'Updating Contacts'; return v_return; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; Index: openacs-4/packages/contacts-lite/sql/postgresql/contacts-sc-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/contacts-lite/sql/postgresql/contacts-sc-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/contacts-lite/sql/postgresql/contacts-sc-create.sql 20 Jan 2021 18:35:37 -0000 1.1 +++ openacs-4/packages/contacts-lite/sql/postgresql/contacts-sc-create.sql 20 Jan 2021 21:07:14 -0000 1.2 @@ -21,26 +21,26 @@ ); -create function contacts__itrg () -returns opaque as ' -begin - perform search_observer__enqueue(new.contact_id,''INSERT''); +CREATE OR REPLACE FUNCTION contacts__itrg () RETURNS trigger AS $$ +BEGIN + perform search_observer__enqueue(new.contact_id,'INSERT'); return new; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create function contacts__dtrg () -returns opaque as ' -begin - perform search_observer__enqueue(old.contact_id,''DELETE''); +CREATE OR REPLACE FUNCTION contacts__dtrg () RETURNS trigger AS $$ +BEGIN + perform search_observer__enqueue(old.contact_id,'DELETE'); return old; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; -create function contacts__utrg () -returns opaque as ' -begin - perform search_observer__enqueue(old.contact_id,''UPDATE''); +CREATE OR REPLACE FUNCTION contacts__utrg () RETURNS trigger AS $$ +BEGIN + perform search_observer__enqueue(old.contact_id,'UPDATE'); return old; -end;' language 'plpgsql'; +END; +$$ LANGUAGE plpgsql; create trigger contacts__itrg after insert on contacts