Re: CREATE TABLE with a name derived from a string

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: CREATE TABLE with a name derived from a string
Дата
Msg-id 20030214103333.Q64558-100000@megazone23.bigpanda.com
обсуждение исходный текст
Ответ на CREATE TABLE with a name derived from a string  (JSavage@data-mate.com (Savage))
Ответы Re: CREATE TABLE with a name derived from a string
Список pgsql-general
On 12 Feb 2003, Savage wrote:

> I am creating a DB for a multi user IM system. Each user can store
> their history. Each user also has a unique ID. There will be many
> users and a lot of history will be generated by each user, so we are
> going to create a history table per user, with a tablename that is
> derived from the unique userid. I've hit a problem implementing this
> scheme.
>
> I want to be able to write a stored procedure in postgres that takes
> an integer userid as a param and creates a table called
> History.<userid>. (e.g. History.695). My dream is:
>
> CREATE TABLE 'History' || $1 (...);

I think using execute might work:

EXECUTE ''CREATE TABLE History'' || $1 || '' (...);'';


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

Предыдущее
От: Francisco J Reyes
Дата:
Сообщение: Re: Measuring Performance/Tuning
Следующее
От: Arguile
Дата:
Сообщение: Re: natural sort order