Unix Technical Forum

Re: domains, types, constraints

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 ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 10:51 PM
Andrew Winkler
 
Posts: n/a
Default Re: domains, types, constraints

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 01:33 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com