Re: CREATE CAST question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: CREATE CAST question
Дата
Msg-id 15155.1123302024@sss.pgh.pa.us
обсуждение исходный текст
Ответ на CREATE CAST question  ("Robert Wimmer" <seppwimmer@hotmail.com>)
Список pgsql-novice
"Robert Wimmer" <seppwimmer@hotmail.com> writes:
> I want to define a schema qualified domain and create a cast to cast a
> string in the new domain.

Casts between domains and their underlying types are hard-wired into the
system: you don't get to muck with the semantics by doing CREATE CAST.

The correct way to do this is to define a constraint on the domain,
along the lines of

    create function is_ok_ident(text) returns bool as '
        ... return true if you like the string ...
    ' language plpgsql;

    create domain ident as text check (is_ok_ident(value));

            regards, tom lane

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

Предыдущее
От: "Robert Wimmer"
Дата:
Сообщение: CREATE CAST question
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Monitoring postmaster.log