Search Postgresql Archives

return query execute SQL-problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

here is something I don't quite grasp (PG 9.1.3): This function:

CREATE OR REPLACE FUNCTION f_aliastest()
  RETURNS setof text AS
$BODY$
declare sql text;
begin           
  sql:='SELECT ''sometext''::text as alias';
  return query execute SQL;
end;
$BODY$
LANGUAGE plpgsql VOLATILE;

returns its result as:

contactking=# select * from f_aliastest();

 f_aliastest 
-------------
 sometext
(1 row)

I was hoping I'd get the data back as 'alias', not as 'f_aliastest'. If I do:

contactking=# select alias from f_aliastest();
ERROR:  column "alias" does not exist
LINE 1: select alias from f_aliastest();

Is there a way that I can make my function return the field aliases?

Best wishes from Berlin,

Maximilian Tyrtania
http://www.contactking.de



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux