Re: Creating new table with a function? - Mailing list pgsql-novice

From Andreas Kretschmer
Subject Re: Creating new table with a function?
Date
Msg-id 20140816141839.GA2363@tux
Whole thread Raw
In response to Creating new table with a function?  (Csányi Pál <csanyipal@gmail.com>)
List pgsql-novice
Csányi Pál <csanyipal@gmail.com> wrote:

> Hi,
>
> Is it possible to create a new table with help of a function?
>
> I want to create a new table in my database by using a function that
> get datas from existing tables so it can to create a new table with
> fields.
>
> Can one create such function?
> If the answer is yes, then how can one do this?
> Where is described in documentation creating such custom functions?

Sure, you can.

http://www.postgresql.org/docs/9.3/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

40.5.4. Executing Dynamic Commands


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°


pgsql-novice by date:

Previous
From: Csányi Pál
Date:
Subject: Creating new table with a function?
Next
From: Marc Richter
Date:
Subject: Re: Upgrading from PG 8.2.5 to 9.1.13