Re: Create function problem - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Create function problem
Date
Msg-id 20060804003334.GA42945@winnie.fuhr.org
Whole thread Raw
In response to Re: Create function problem  (gustavo halperin <ggh.develop@gmail.com>)
List pgsql-general
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

pgsql-general by date:

Previous
From: gustavo halperin
Date:
Subject: Re: Create function problem
Next
From: "Jaime Casanova"
Date:
Subject: Re: Dumping database using 8.1 or 7.1