Q: Rename constraint

Started by Tilo Schwarzabout 23 years ago2 messagesgeneral
Jump to latest
#1Tilo Schwarz
mail@tilo-schwarz.de

Hi,

I want to rename several constraints. But I didn't find a way to rename a
constraint (eg. a foreign key constraint) except of dropping and recreating
it (with alter table) - am I right?

Now my question is, if I can directly change the value of
"pg_constraint.conname", or am I calling for trouble that way?

Thanks and regards,

Tilo

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tilo Schwarz (#1)
Re: Q: Rename constraint

Tilo Schwarz <mail@tilo-schwarz.de> writes:

Now my question is, if I can directly change the value of
"pg_constraint.conname", or am I calling for trouble that way?

If it's a foreign-key constraint, I think you'd also need to update
pg_trigger.tgconstrname for the triggers belonging to the constraint.

regards, tom lane