Re: Create function problem - Mailing list pgsql-general

From gustavo halperin
Subject Re: Create function problem
Date
Msg-id 44D2BC19.1020702@gmail.com
Whole thread Raw
In response to Create function problem  (gustavo halperin <ggh.develop@gmail.com>)
Responses Re: Create function problem  (Michael Fuhr <mike@fuhr.org>)
List pgsql-general
Ron St-Pierre wrote:
> Check your spelling of public:
> SELECT * FROM f_describe_tables('pubilc', 'mil_cien_diez');
>
> Ron
>
*OK thank you, you right, but after write "public" I receive again an
empty row, Why??.
By the way I wrote a short function:*

/mydb=> SELECT c.column_name, c.data_type
mydb-> FROM information_schema.columns c
mydb-> WHERE c.table_schema = 'public' AND c.table_name = 'mil_cien_diez';
 column_name | data_type
-------------+-----------
 miles       | smallint
 cientos     | smallint
 decenas     | smallint
(3 rows)

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;
CREATE FUNCTION
mydb=> SELECT * FROM f_describe_tables('public', 'mil_cien_diez');
 column1 | column2
---------+---------
         |
(1 row)
/

pgsql-general by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Create function problem
Next
From: Michael Fuhr
Date:
Subject: Re: Create function problem