Re: Creating new table with a function?

From: Andreas Kretschmer <akretschmer(at)spamfence(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Creating new table with a function?
Date: 2014-08-16 14:18:40
Message-ID: 20140816141839.GA2363@tux
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Csányi Pál <csanyipal(at)gmail(dot)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°

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Marc Richter 2014-08-17 15:36:49 Re: Upgrading from PG 8.2.5 to 9.1.13
Previous Message Csányi Pál 2014-08-16 14:08:14 Creating new table with a function?