mirror of
https://github.com/postgres/postgres.git
synced 2025-07-05 07:21:24 +03:00
Ok. Updated patch attached.
- domain.patch -> source patch against pgsql in cvs - drop_domain.sgml and create_domain.sgml -> New doc/src/sgml/ref docs - dominfo.txt -> basic domain related queries I used for testing [ ADDED TO /doc] Enables domains of array elements -> CREATE DOMAIN dom int4[3][2]; Uses a typbasetype column to describe the origin of the domain. Copies data to attnotnull rather than processing in execMain(). Some documentation differences from earlier. If this is approved, I'll start working on pg_dump, and a \dD <domain> option in psql, and regression tests. I don't really feel like doing those until the system table structure settles for pg_type. CHECKS when added, will also be copied to to the table attributes. FK Constraints (if I ever figure out how) will be done similarly. Both will lbe handled by MergeDomainAttributes() which is called shortly before MergeAttributes(). Rod Taylor
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.64 2001/10/25 05:49:39 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/parser/parse_coerce.c,v 2.65 2002/03/06 20:34:51 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -38,6 +38,7 @@ coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
|
||||
{
|
||||
Node *result;
|
||||
|
||||
|
||||
if (targetTypeId == inputTypeId ||
|
||||
targetTypeId == InvalidOid ||
|
||||
node == NULL)
|
||||
@ -605,3 +606,32 @@ PreferredType(CATEGORY category, Oid type)
|
||||
}
|
||||
return result;
|
||||
} /* PreferredType() */
|
||||
|
||||
|
||||
/*
|
||||
* If the targetTypeId is a domain, we really want to coerce
|
||||
* the tuple to the domain type -- not the domain itself
|
||||
*/
|
||||
Oid
|
||||
getBaseType(Oid inType)
|
||||
{
|
||||
HeapTuple tup;
|
||||
Form_pg_type typTup;
|
||||
|
||||
tup = SearchSysCache(TYPEOID,
|
||||
ObjectIdGetDatum(inType),
|
||||
0, 0, 0);
|
||||
|
||||
typTup = ((Form_pg_type) GETSTRUCT(tup));
|
||||
|
||||
/*
|
||||
* Assume that typbasetype exists and is a base type, where inType
|
||||
* was a domain
|
||||
*/
|
||||
if (typTup->typtype == 'd')
|
||||
inType = typTup->typbasetype;
|
||||
|
||||
ReleaseSysCache(tup);
|
||||
|
||||
return inType;
|
||||
}
|
Reference in New Issue
Block a user