Adrian Klaver-4 wrote > Here is my very similar function: > > CREATE OR REPLACE FUNCTION utility.archive_del_record() RETURNS trigger AS > $BODY$ > DECLARE > tbl_name text := TG_TABLE_NAME || '_delete' ; > archive_row hstore := hstore(OLD.*); > user_name text := session_user; > BEGIN > EXECUTE 'INSERT INTO ' ||quote_ident(tbl_name) || > '(record_fld, del_ts, del_user)' > || ' VALUES('||quote_literal(archive_row)||', now(),' || > quote_literal(user_name)||')'; > RETURN OLD; > END; > $BODY$ > LANGUAGE plpgsql SECURITY DEFINER; Thank you Adrian you made my day! I compared our functions and came out that the problem was only in quotes... I have used 3 of them and with hstore one is enough. -- View this message in context: http://postgresql.nabble.com/Escaping-text-hstore-tp5870728p5870762.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general