I'm new using pl pgsql, with my pseudo code below i'm getting this error:
relation "Client.seniority_day" does not exist
How to resolve it please?
code
DROP FUNCTION IF EXISTS table_sen_seniority;
CREATE OR REPLACE FUNCTION Client.table_sen_seniority(granularity text, OUT max_date date)
RETURNS record
LANGUAGE plpgsql
AS $function$
declare
    table_sen text := 'Client.seniority'||granularity;
 BEGIN
     execute format('SELECT MIN(dat_sub) FROM %I', table_sen) INTO subscription_from;
     execute format('SELECT FROM %I WHERE date_ >= $1', table_sen) using subscription_from;
 END;
$function$
 ;
update
execute format('SELECT FROM %I WHERE date_ >= $1', table_sen) using subscription_from;


granularityin a tableseniority(not different tables with different suffixes)