Composite type, DEFAULT, NOT NULL, REFERENCES

Поиск
Список
Период
Сортировка
От erhaminus
Тема Composite type, DEFAULT, NOT NULL, REFERENCES
Дата
Msg-id 1e4f58e1.6aac820e.4e9edf92.278e7@o2.pl
обсуждение исходный текст
Ответы Re: Composite type, DEFAULT, NOT NULL, REFERENCES
Re: Composite type, DEFAULT, NOT NULL, REFERENCES
Список pgsql-general
Hi,

Is a way to define DEFAULT, NOT NULL and REFERENCES for members of composite type?

For example:

-- type
CREATE TYPE bibl.bibliography AS
(
    edition TEXT,
    publisher_id BIGINT
);

-- table def
create table bibl.monograph
(
    id BIGSERIAL PRIMARY KEY NOT NULL,
    bibl bibl.bibliography
);

-- how to do that, assuming that:
--    we want edition NOT NULL, DEFAULT with value "first"
--    we want publisher_id reffering to bibl.publisher(id)

This does not work for me:

ALTER TABLE bibl.monograph ALTER COLUMN (bibl).is_bibliography SET NOT NULL;
ALTER TABLE bibl.monograph ALTER COLUMN (bibl).is_bibliography SET DEFAULT false;

Thanks in advance,
Best regards


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

Предыдущее
От: Achilleas Mantzios
Дата:
Сообщение: Re: installing tsearch2
Следующее
От: senthilnathan
Дата:
Сообщение: Recovery from Archive files