postgresql - How could I return a varchar message in Postgres as part of function return table that isn't in any table? -


i need return message (a different message according evaluations inside de function), when call function returns error message: "returned type unknown not match expected type character varying in column 2".

create or replace function myfunction()returns table( cod integer,  answ character varying  ) $body$  begin  return query     select 0, 'here goes message'; end; $body$  language plpgsql; 

try:

create or replace function myfunction()returns table( cod integer,  answ character varying  ) $body$  begin  return query     select 0, 'here goes message'::character varying; end; $body$  language plpgsql; 

Comments

Popular posts from this blog

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -