2

I'd like to create an IMMUTABLE wrapper function as discussed by https://stackoverflow.com/a/11007216/14731 but it's not clear how to proceed. The above Stackoverflow answer provides the following example:

For example, given:

CREATE OR REPLACE FUNCTION public.immutable_unaccent(regdictionary, text)
  RETURNS text LANGUAGE c IMMUTABLE PARALLEL SAFE STRICT AS
'$libdir/unaccent', 'unaccent_dict';

CREATE OR REPLACE FUNCTION public.f_unaccent(text)
  RETURNS text LANGUAGE sql IMMUTABLE PARALLEL SAFE STRICT AS
$func$
SELECT public.immutable_unaccent(regdictionary 'public.unaccent', $1)
$func$;

I scanned all the libraries in lib/ and as far as I can tell none of them export functions related to record_out(). Any ideas?

Gili
  • 86,244
  • 97
  • 390
  • 689

1 Answers1

2

The record_out() function is an internal built-in function. You can get its definition like this:

select pg_get_functiondef('record_out'::regproc);

                    pg_get_functiondef
----------------------------------------------------------
 CREATE OR REPLACE FUNCTION pg_catalog.record_out(record)+
  RETURNS cstring                                        +
  LANGUAGE internal                                      +
  STABLE PARALLEL SAFE STRICT                            +
 AS $function$record_out$function$                       +

I don't know for what purpose you want the wrapping function. It only remains to warn that such a change may bring unexpected results.

klin
  • 112,967
  • 15
  • 204
  • 232
  • 1
    I kept the question as-is and post a separate question explaining what I am trying to do: https://stackoverflow.com/q/72468749/14731 – Gili Jun 01 '22 at 22:40