----------------------------/CREATE FUNCTION/-----------------------------------
CREATE
OR REPLACE FUNCTION "public"."my_to_char" (some_time DATE) RETURNS "pg_catalog"."text" AS $BODY$ SELECT
	to_char($1, 'YYYY-MM-DD') ; $BODY$ LANGUAGE 'sql' IMMUTABLE COST 100;

ALTER FUNCTION "public"."my_to_char" (some_time DATE) OWNER TO "postgres";

------------------------------/CREATE INDEX/-------------------------------------
CREATE INDEX full_text_patient_search ON person_data USING gin (
	to_tsvector(
		'simple',
		first_name || ' ' || second_name || ' ' || first_last_name || ' ' || second_last_name || ' ' || DOCUMENT || ' ' || my_to_char(date_birth)
	)
)