Create Table Dinamic

Поиск
Список
Период
Сортировка
От Anderson dos Santos Donda
Тема Create Table Dinamic
Дата
Msg-id ad072ae30808061810u60cebecbo370f0f5d23ed58c2@mail.gmail.com
обсуждение исходный текст
Ответы Re: Create Table Dinamic  ("mian wang" <lonelycat1984@gmail.com>)
Re: Create Table Dinamic  (Craig Ringer <craig@postnewspapers.com.au>)
Re: Create Table Dinamic  ("Igor Neyman" <ineyman@perceptron.com>)
Re: Create Table Dinamic  (Lennin Caro <lennin.caro@yahoo.com>)
Список pgsql-general
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.

В списке pgsql-general по дате отправления:

Предыдущее
От: John DeSoi
Дата:
Сообщение: Re: looking for psql without server-installation
Следующее
От: "mian wang"
Дата:
Сообщение: Re: Create Table Dinamic