473,386 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Domains and function


I can create a function with a domain and
define it to return a domain.

The parameter is checked to see if it qualifies
in the constraint of the domain, however, the
return value is not.

Is this a bug? Is the author of the function
responsible for re-inforcing the constraint
at runtime?

This is the test case in 7.4:

=# create domain one2hundred AS integer
-# DEFAULT '1' CONSTRAINT email_domain check( VALUE > 0 AND VALUE <=100 );
CREATE DOMAIN
=#
=# create function gb52_add( one2hundred )
-# returns one2hundred as
-# '
'# BEGIN
'# RETURN $1 + 10;
'# END;
'# ' language 'plpgsql';
CREATE FUNCTION
=#
=# select gb52_add( 80);
gb52_add
----------
90
(1 row)

=# select gb52_add( 100);
gb52_add
----------
110
(1 row)

=# select gb52_add( 90);
gb52_add
----------
100
(1 row)

=# select gb52_add( 91);
gb52_add
----------
101
(1 row)

=# select gb52_add( 191);
ERROR: value for domain one2hundred violates check constraint "email_domain"
================================================== ==========
el***@varlena.com Varlena, LLC www.varlena.com

PostgreSQL Consulting, Support & Training

PostgreSQL General Bits http://www.varlena.com/GeneralBits/
================================================== ===========
I have always depended on the [QA] of strangers.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #1
0 1032

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: d.schulz81 | last post by:
Hi all, We have about 10 different domains that are linked very closely and we want to identify and keep track of every single user that surfs our websites by the use of sessions. The problem...
7
by: | last post by:
I think I may have a problem with the user of cookies in my centralized logon and registration system that I hoped could be consumed by all the sub-domains on my remote host IP. I built the...
1
by: WeAreGoing! | last post by:
Hello. I need to transfer an MD5 digest number between two pages on different domains. I know this is generally not possible, but I have full access on one domain and can insert Javascript at...
1
by: Silver Arrow | last post by:
Iframe ReturnValue returns undefined if domains are not the same I am using a modal window and an iFrame to try and pull a return value back. IMPORTANT : I am doing this across domains. Main...
6
by: onetitfemme | last post by:
Domain are very cheap now adays. What would be the pros and cons of using different hosts served from the same server, say: www.blogyourbrainoff.com and www.yourbusiness.com
1
by: Paul Fi | last post by:
I have some confusions about the two, is it possible to create threads inside a particular domain and have other threads created in another domain or do we create threads that will manipulate app...
8
by: Bern McCarty | last post by:
Is it at all possible to leverage mixed-mode assemblies from AppDomains other than the default AppDomain? Is there any means at all of doing this? Mixed-mode is incredibly convenient, but if I...
6
by: Ludvig | last post by:
I have various domains using the same application/assembly They differ in contents and design, based on a "site id", and get its information from an SQL server. Now I have to deploy the...
7
by: Doug | last post by:
An ASP.NET session cookie set on "www.mydomain.com" can not be accessed on "search.mydomain.com"; hence, a new session and cookie are being created on every sub-domain. This is occuring because...
6
by: PD | last post by:
I have a parent .Net page (http://mywebsite/project.aspx) that has an iframe (http://iframe/iframe.aspx) which are on seperate domains. I need to adjust the scrolling on the parent window due the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.