From: | Lennin Caro <lennin(dot)caro(at)yahoo(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org, Anderson dos Santos Donda <andersondonda(at)gmail(dot)com> |
Subject: | Re: Create Table Dinamic |
Date: | 2008-08-08 03:45:06 |
Message-ID: | 561296.65056.qm@web59509.mail.ac4.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
try whit this
http://www.postgresql.org/docs/8.3/interactive/ecpg-dynamic.html
--- On Thu, 8/7/08, Anderson dos Santos Donda <andersondonda(at)gmail(dot)com> wrote:
> From: Anderson dos Santos Donda <andersondonda(at)gmail(dot)com>
> Subject: [GENERAL] Create Table Dinamic
> To: pgsql-general(at)postgresql(dot)org
> Date: Thursday, August 7, 2008, 1:10 AM
> Hello All!
>
> Its my first time here in maillist and I started work with
> postgre on last
> moth.
>
> My questions is: Threre is a way to create tables dinamic?
>
> Example:
>
> To create a table we use CREATE TABLE TableName ......
>
> In my db, I have many tables with diferents names but with
> same colums
>
> Example:
>
> TableOne ( id int, name text );
> TableTwo ( id int, name text );
> TableThree ( id int, name text );
>
> So, I created a function to create me this tables with
> diferents names
>
> CREATE OR REPLACE FUNCTION MakeTables ( NameTable text )
> RETURNS VOID
> $$
> BEGIN
> CREATE TABLE NameTable ( id int, name text );
> END;
> $$
> LANGUAGE 'plpgsql';
>
> But, the plpgsql or postgre don't accept this..
>
> So, How can I create a table with my function?
>
> Thanks for any helps!!!
>
> PS : If somebody want knows why I need to create this
> function, is because
> in my db have 1000 tables with the some colums, and each
> time I have a new
> client, I need to create this tables manually.
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Marlowe | 2008-08-08 06:49:19 | Re: restoring one table? |
Previous Message | Steve Atkins | 2008-08-08 01:08:49 | Re: bytea encode performance issues |