On Mon, Jun 25, 2018 at 07:06:06PM +0530, Gaurav Mishra wrote:
> here what i expect as a output :
>
> create extension table_name-extract;
>
> select extract_tablename();
>
> table-name datatype-name
> new_table name new
> new_table1 name1 new1
>
> extract_tablename : this function should give me a table name with
> data_type inside contrib module so that i can use in the extension .
It is possible to know what is the set of objects registered within an
extension using a lookup to system catalogs. The internal set of
queries used by psql is full of good patterns, so why not looking at
what psql -E does when using psql shortcuts and build up a query which
does what you are looking for? If you filter the set of objects by type
(a table), then you can look at pg_attribute and get all the column names
you are looking for. There is also not special need to write C code for
that.
--
Michael