Questions tagged [domain]
SQL Domain Constraints: constraints applied to a data type providing centralized management and data validity
1
vote
1answer
17 views
How to specify the domain of an attribute in an entity-relationship diagram (ERD)?
In an ERD (as in, rectangles for entity types, diamonds for relationship types, ovals for attributes, etc.) how would one specify that an attribute is, say, a 5-letter word?
1
vote
0answers
45 views
sys.login_token doesn't include particular windows groups while they can be listed by sys.database_principals
When I query
SELECT principal_id, name, [type]
FROM sys.login_token
I found some local windows groups were not there.
However, when I check by
SELECT principal_id, name, [type]
FROM sys....
1
vote
0answers
60 views
Is it possible to define a cast between text and a domain representing a uuid to avoid manual casts?
I created a DOMAIN as following:
CREATE DOMAIN country_id AS uuid;
I create such domains for readability. It is much easier to read function definitions which accept a country_id instead of a uuid.
...
1
vote
0answers
138 views
In PostgreSQL, how to deal with error messages that show almost no context?
Today I realized a number of points where PostgreSQL (v10.3) is rather lackluster and sparse in its error messages.
The first point is illustrated by this code:
drop schema if exists X cascade;
...
2
votes
1answer
91 views
Ranges over domains do not trigger implicit casting
As far as I was able to find out, it is currently not possible in PostgreSQL v9.5 (and above?) to obtain implicit casting with custom range types. To illustrate,
when I define the following demo setup:...
7
votes
2answers
543 views
Does SQL Server support custom DOMAINs?
PostgreSQL supports the DOMAIN specification, from SQL 2011 working draft spec,
A domain is a named user-defined object that can be specified as an alternative to a data type in certain places ...
2
votes
1answer
95 views
What are the drawbacks of using DOMAINS to store metadata about the column?
I came across a question about a data type for MD5 values. The recommendation in that question states using uuid as type for that field.
The argumentation is solid. But I find that this might be ...
3
votes
3answers
3k views
Creating a DOMAIN in MySQL or MariaDB?
As far as I know, DOMAINS cannot be created in MySQL. Is there any disadvantage for that? Is there something to be used instead of using CREATE DOMAIN?
2
votes
2answers
2k views
How do I list the constraints of a DOMAIN?
Consider the following scenario:
CREATE DOMAIN dom_zipcode AS text;
ALTER DOMAIN dom_zipcode
ADD CONSTRAINT zipchk CHECK (char_length(VALUE) = 5);
Now, if I want to drop that constraint with ALTER ...
2
votes
1answer
58 views
Can I create a DOMAIN on a range of years
I have to create a custom domain that is an interval between two years, but i actually need both years.
For example:
'2013/2014'
'2015/2016'
Is there a way to pack both years inside a single domain, ...
4
votes
1answer
2k views
Show DOMAIN details
Showing the columns and constrains of a table in PostgreSQL is done with:
\d+ <table_name>
Which lists the columns, data types and modifiers for a table.
How can I show the details and ...
2
votes
1answer
515 views
How to apply a newly-created Domain to an existing Column?
In Postgres 9.4 Beta 1, I successfully created a domain of type VARCHAR, fuel_domain_. The domain checks that a value is any of 5 possible strings, coal, gas, wind, hydro, other.
CREATE DOMAIN ...
0
votes
1answer
72 views
Use a DOMAIN in multiple schemas
The PostgreSQL CREATE DOMAIN command appears to create the domain at the schema level. Is there a best approach I should be aware of that would allow me to reuse domains across the multiple schemas ...
1
vote
2answers
49 views
Making a domain conditional on other values in the table
How can I define or change a domain based on another attribute value?
F.e. domain for salary is a numeric value > 500. But if a date the person was hired > January 1st, 2013, then the salary must be >...