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; --> Thanks for responding. Here's a simple example of the kind of thing I'm trying to do: postgres=# drop type ...


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

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

Thanks for responding. Here's a simple example of the kind of thing I'm trying to do:

postgres=# drop type complex;
DROP TYPE
postgres=# create type complex as (r numeric, i numeric);
CREATE TYPE
postgres=# create domain unitary as complex;
ERROR: "complex" is not a valid base type for a domain
postgres=#

The idea in this example would be to create a domain of complex numbers where
r*r + i*i is not zero.

Are composite types not useable for domains?

----- Original Message ----
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Winkler <the_andrew_winkler@yahoo.com>
Cc: pgsql-novice@postgresql.org
Sent: Tuesday, January 15, 2008 8:55:34 PM
Subject: Re: [NOVICE] domains, types, constraints


Andrew Winkler <the_andrew_winkler@yahoo.com> writes:
> I'm having trouble with types and domains. I can create a type, but

then when I try to create constraints
> using the components of the type, I get syntax errors. I've read

through the pdf several times, to no avail.
> Things like (value).component, component(value), value::component,

for example, all generate errors.

This is nearly content-free :-(. Show us exactly what commands you
tried and what errors you got. (Cut and paste from a terminal window
is good.)

regards, tom lane

---------------------------(end of
broadcast)---------------------------
TIP 6: explain analyze is your friend





__________________________________________________ __________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsea...egory=shopping

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at

http://www.postgresql.org/about/donate

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 11:51 PM
Tom Lane
 
Posts: n/a
Default Re: domains, types, constraints

Andrew Winkler <the_andrew_winkler@yahoo.com> writes:
> postgres=# create type complex as (r numeric, i numeric);
> CREATE TYPE
> postgres=# create domain unitary as complex;
> ERROR: "complex" is not a valid base type for a domain


> Are composite types not useable for domains?


Nope, sorry. We currently only support domains over base types.

I don't think anyone's even thought about doing the above, though
it does seem like a potentially useful thing.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

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 09:19 AM.


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