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

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

javascript - Confirm a form & display message if form is valid with JQuery -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -