Re: Create function problem

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: gustavo halperin <ggh(dot)develop(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Create function problem
Date: 2006-08-04 00:33:35
Message-ID: 20060804003334.GA42945@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jaime Casanova 2006-08-04 01:00:25 Re: Dumping database using 8.1 or 7.1
Previous Message Michael Fuhr 2006-08-04 00:18:21 Re: Create function problem