Greetings! I just discovered the existence of a couple of functions I don't understand in one customer's PostgreSQL database: -- Function: c_mode() -- DROP FUNCTION c_mode(); CREATE OR REPLACE FUNCTION c_mode() RETURNS text AS $BODY$ UPDATE pg_type SET typoutput='c_textout' WHERE typname='SET'; UPDATE pg_type SET typoutput='c_varcharout' WHERE typname='bpchar'; UPDATE pg_type SET typoutput='c_textout' WHERE typname='bytea'; UPDATE pg_type SET typoutput='c_charout' WHERE typname='char'; UPDATE pg_type SET typoutput='c_textout' WHERE typname='text'; UPDATE pg_type SET typoutput='c_textout' WHERE typname='unknown'; UPDATE pg_type SET typoutput='c_varcharout' WHERE typname='varchar'; select 'c_mode'::text;$BODY$ LANGUAGE 'sql' VOLATILE; ALTER FUNCTION c_mode() OWNER TO postgres;
-- Function: pg_mode() -- DROP FUNCTION pg_mode(); CREATE OR REPLACE FUNCTION pg_mode() RETURNS text AS $BODY$ UPDATE pg_type SET typoutput='textout' WHERE typname='SET'; UPDATE pg_type SET typoutput='varcharout' WHERE typname='bpchar'; UPDATE pg_type SET typoutput='textout' WHERE typname='bytea'; UPDATE pg_type SET typoutput='charout' WHERE typname='char'; UPDATE pg_type SET typoutput='textout' WHERE typname='text'; UPDATE pg_type SET typoutput='textout' WHERE typname='unknown'; UPDATE pg_type SET typoutput='varcharout' WHERE typname='varchar'; select 'pg_mode'::text;$BODY$ LANGUAGE 'sql' VOLATILE; ALTER FUNCTION pg_mode() OWNER TO postgres; This customer has demanded extensive modifications to their database and our application. I think these functions are used in encryption, since there are several other non-standard functions in this database that are related to encryption. Our lead developer is in another state, and is naturally very uncommunicative. When I asked him about the c_mode() function and expressed concern that changing pg_type records might not be a good idea, his reply was: "Ignore it, it is a database contrib routine for string I/O. It doesn't change the database properties." Are these functions really as innocuous as he claims? It seems to me that between the time c_mode() is called and the time that pg_mode() is called, any other database access is likely to be confused. Thank you very much. RobR