Search Postgresql Archives

Re: Create function problem

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

 



On Fri, Aug 04, 2006 at 06:16:41AM +0300, gustavo halperin wrote:
> *OK thank you, you right, but after write "public" I receive again an 
> empty row, Why??.
[...]
> mydb=> CREATE OR REPLACE FUNCTION f_describe_tables (v_tbl_scm text, 
> v_tbl_name text,
> mydb(> OUT  text, OUT text) as
> mydb-> $$ SELECT c.column_name, c.data_type
> mydb$> FROM information_schema.columns c
> mydb$> WHERE c.table_schema = 'v_tbl_schm' AND c.table_name = 'v_tbl_name'
> mydb$> $$ LANGUAGE SQL;

You've hardcoded the strings 'v_tbl_schm' and 'v_tbl_name' instead
of using the function's arguments.  I don't think SQL functions
support named arguments so you'll need to use $1 and $2.  You'll
also need to use "RETURNS SETOF record" if you want to return more
than one row.

-- 
Michael Fuhr


[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