How to return a varchar type in a select of a free string. example: Select 'Test' as field from table
Maybe you just need to cast it.

 SELECT CAST( 'Text' as CHARACTER VARYING(99999) ) as FIELD FROM TABLE;


or using an alternative pg-specific casting syntax.

 SELECT 'Text'::varchar as FIELD FROM TABLE;


If you select a string constant and don't cast it to something it has type unknown.  but I'm guessing your connection library converts this to the preferred postgres string type 'text'