Can we pass a varchar/text datatype in to a variable in pgbench?
According to the documentation, pgbench variables are supposed to be boolean, integer, float, or variable-references.

However it appears to be possible to pass arbitrary text to --define so long as you don't try to use pgbench operators that will treat it as a numeric value.

pgbench doesn't support psql-style :'quoted_variable' syntax for literals or :"quoted_variable" for identifiers. So you have to quote the value you pass.

e.g. if you invoke pgbench with --define "v_username='fred'" then the variable's string value will be 'fred', including the quotes. You can then write:

\setrandom cnt 1 100000

begin;
select get_user_email('user_' || :v_username);
end;


Note that the concatenation is done in SQL, as pgbench expression language doesn't have string operators.