Check constraints.

Поиск
Список
Период
Сортировка
От Steve Rogerson
Тема Check constraints.
Дата
Msg-id a6c7c35e-07d5-6a6c-0d60-5e3c0b439003@yewtc.demon.co.uk
обсуждение исходный текст
Ответы Re: Check constraints.
Список pgsql-general
williamI am trying to add/change a constraint programmatically, but not if it
already exists, and is the same as before.


I can so something like (may not be precise ...)

select check_clause from information_schema.check_constraints where
constraint_name = 'my-name'

but this returns that clause in a normalised format that is not compatible
with the text I am trying to compare, so I'm adding something like ...

alter table my_table  add check (my_type = any (array['GOOD' , 'BAD']))

but the check_clause from above looks like ...

(((my_type)::text = ANY (ARRAY['GOOD'::text, 'BAD'::text])))

Is there a way of getting the "normalised" version of constraint so decide if
I need to update the constraint if one already exists?

Steve




В списке pgsql-general по дате отправления:

Предыдущее
От: Blake McBride
Дата:
Сообщение: Re: Must re-connect to see tables
Следующее
От: Ron
Дата:
Сообщение: Re: Must re-connect to see tables