Обсуждение: Q: Rename constraint

Поиск
Список
Период
Сортировка

Q: Rename constraint

От
Tilo Schwarz
Дата:
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


Re: Q: Rename constraint

От
Tom Lane
Дата:
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