From: | "John Savage" <JSavage(at)data-mate(dot)com> |
---|---|
To: | "'Stephan Szabo'" <sszabo(at)megazone23(dot)bigpanda(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: CREATE TABLE with a name derived from a string |
Date: | 2003-02-14 19:21:01 |
Message-ID: | 006801c2d45e$36aae920$bafe7343@development1 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
I came across the EXECUTE command while googling for a solution to this
problem but found
a) it was incredibly hard to read because of all the quotes and
b) I couldn't find much documentation for it. It isn't mentioned on the main
red hat postgreSQL manual pages at all
(http://www.redhat.com/docs/manuals/database/) and the word EXECUTE isn't
the best word to google on :). The best resource for plpgsql I could find is
at http://www.phpfreaks.com/postgresqlmanual/page/plpgsql.html but I wasn't
sure if this was going to help me. Are there any better resources for
plpgsql? I'll look into it more now anyway. Thanks.
Meantime, I got a reply from Dmitry Tkach yesterday that made me reconsider
why we are taking this approach. Short term I no longer need this
functionality, but will be needing it over the coming weeks for definite.
Thanks,
John
_____
John Savage <mailto:jsavage(at)data-mate(dot)com>
Software Engineer DataMate Global Communications
Tel: +1 818 487 3900 ext105
_____
-----Original Message-----
From: Stephan Szabo [mailto:sszabo(at)megazone23(dot)bigpanda(dot)com]
Sent: Friday, February 14, 2003 10:36 AM
To: Savage
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] CREATE TABLE with a name derived from a string
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 || '' (...);'';
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2003-02-14 19:35:01 | Re: for installation |
Previous Message | scott.marlowe | 2003-02-14 19:19:15 | Re: [GENERAL] [CYGWIN] What other parameters to consider when |