| From: | "Mick van der Most van Spijk" <mick(at)nederland(dot)net> |
|---|---|
| To: | pgsql-general(at)postgresql(dot)org |
| Subject: | Dynamically create scheme |
| Date: | 2003-02-26 14:50:12 |
| Message-ID: | b3ik95$24kg$1@news.hub.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
Hi,
I am writing an installscript and I would like to create a schema
dynamically, based on a new input.
-- this is the trigger that calls the install script
CREATE TRIGGER tr_install_account AFTER INSERT
ON accounts FOR EACH ROW
EXECUTE PROCEDURE install();
-- the install script
1 CREATE OR REPLACE FUNCTION install() RETURNS TRIGGER
2 AS '
3 BEGIN
4 INSERT INTO bedrijven (kvk, account) VALUES (''00000000'', NEW.account);
5 INSERT INTO settings (account, logo) VALUES (NEW.account, '''');
6 CREATE SCHEMA NEW.account;
7 RETURN NEW;
8 END;
9 ' LANGUAGE 'plpgsql';
It goes wrong at line 9. I want to create a schema based on the accountname
supplied. But i cant get it to work. Does anybody know how i get it to work
or what reference i must read?
Regards,
Mick vd Most v Spijk
--
'It never hurts to help' -- Eek the Cat
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2003-02-26 15:08:54 | Re: 7.4? |
| Previous Message | greg | 2003-02-26 14:44:08 | Suggestion for the postgresql.org survey |