Re: domains, types, constraints

Поиск
Список
Период
Сортировка
От Andrew Winkler
Тема Re: domains, types, constraints
Дата
Msg-id 698627.31080.qm@web52710.mail.re2.yahoo.com
обсуждение исходный текст
Ответ на domains, types, constraints  (Andrew Winkler <the_andrew_winkler@yahoo.com>)
Список pgsql-novice
What I wish I could do is something like this:

create domain value as ( amount numeric(30,9), expressedIn int references currency );
which I can't do because domains can't qualify composite types.

So what I'm trying to do instead is something like

create type value as ( amount numeric(30,9), expressedIn int);
create table values ( v value, foreign key ( v.expressedIn) references currency);

but all the ways I can think of trying it give me syntax errors. Am I out of luck?

My impression of the way the system is organized is that it's architected towards extensibility, so
I'd be interested in looking into what it would take to support this kind of thing, but since I've just
started browsing the sources, I'm not up to speed.

Since types are created automatically for tables, with table constraints added in, they are in particular
effectively domains of composite type, anyway, so all the necessary code is already there somewhere,
as is the necessary grammar. The big question of course, is whether that code is tightly coupled in its
place...

Any guesses at what I'd be looking at, on a scale from crazy-to-even-be-thinking-about-it to no-big-deal?








      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page.
http://www.yahoo.com/r/hs

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

Предыдущее
От: Tjibbe
Дата:
Сообщение: pgsql 7.3.2 updating FOREIGN KEYS after transaction
Следующее
От: Jeff Willden
Дата:
Сообщение: Indexes and sequences