From: | Adriaan Joubert <a(dot)joubert(at)albourne(dot)com> |
---|---|
To: | Jan Wieck <wieck(at)debis(dot)com> |
Cc: | Postgresql <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: 7.0 FK trigger question |
Date: | 2000-04-05 05:31:33 |
Message-ID: | 38EACFB5.3F562696@albourne.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>
Thanks for the reply. For the time begin I've solved this by copying every
table in the database to a backup table without any constraints, recreating
the tables and copying the data back in. I have to be a bit careful with
doing it all in the right order, although I think I can solve this by doing
everything in a transaction as the constraints are only checked at the end of
transaction?
> >
> > So I guess my question really boils down to: is it possible to write a
> > function that drops a foreign key trigger or re-instates it? This should
> > really be ALTER TABLE table ALTER COLUMN column (DROP|CREATE)
> > CONSTRAINT.... or something along those lines.
>
> There's still something missing in ALTER TABLE. DROP
> CONSTRAINT is one of them, but since your sequencs with
> renaming the old etc. is the safest possibility anyway, it's
> not that high priority.
OK, I'm definitely not being very bright here, but i cannot get my system to
accept the alter column commands. An example on the man pages ,ay help a lot
here! I tried
test=# create table t (i int4);
CREATE
test=# create table t1 (k int4);
CREATE
test=# alter table t1 alter column k add constraint references t(i);
ERROR: parser: parse error at or near "add"
test=# alter table t1 alter column k constraint references t(i);
ERROR: parser: parse error at or near "constraint"
test=# alter table t1 alter k constraint references t(i);
ERROR: parser: parse error at or near "constraint"
test=# alter table t1 alter column k create constraint references t(i);
ERROR: parser: parse error at or near "create"
So what am I doing wrong?
Thanks,
Adriaan
From | Date | Subject | |
---|---|---|---|
Next Message | Adriaan Joubert | 2000-04-05 05:37:43 | Re: BIT datatype (Fixed) |
Previous Message | Tom Lane | 2000-04-05 04:04:07 | Re: postgres crash on CURSORS |