This is a discussion on Re: domains, types, constraints within the pgsql Novice forums, part of the PostgreSQL category; --> What I wish I could do is something like this: create domain value as ( amount numeric(30,9), expressedIn int ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| 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 ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster |