mirror of
https://github.com/postgres/postgres.git
synced 2025-11-12 05:01:15 +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 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.24 2002/03/02 21:39:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/utils/adt/format_type.c,v 1.25 2002/03/06 20:34:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -126,6 +126,7 @@ format_type_internal(Oid type_oid, int32 typemod,
|
||||
bool is_array;
|
||||
char *name;
|
||||
char *buf;
|
||||
char typtype;
|
||||
|
||||
if (type_oid == InvalidOid && allow_invalid)
|
||||
return pstrdup("-");
|
||||
@@ -144,6 +145,31 @@ format_type_internal(Oid type_oid, int32 typemod,
|
||||
|
||||
array_base_type = ((Form_pg_type) GETSTRUCT(tuple))->typelem;
|
||||
typlen = ((Form_pg_type) GETSTRUCT(tuple))->typlen;
|
||||
typtype = ((Form_pg_type) GETSTRUCT(tuple))->typtype;
|
||||
|
||||
/*
|
||||
* Domains look alot like arrays, so lets process them first, and return
|
||||
* back to avoid the array and 'standard' formatting procedures that are
|
||||
* use for base types.
|
||||
*/
|
||||
if (typtype == 'd') {
|
||||
name = NameStr(((Form_pg_type) GETSTRUCT(tuple))->typname);
|
||||
|
||||
/*
|
||||
* Double-quote the name if it's not a standard identifier.
|
||||
* Note this is *necessary* for ruleutils.c's use.
|
||||
*/
|
||||
if (strspn(name, "abcdefghijklmnopqrstuvwxyz0123456789_") != strlen(name)
|
||||
|| isdigit((unsigned char) name[0]))
|
||||
buf = psnprintf(strlen(name) + 3, "\"%s\"", name);
|
||||
else
|
||||
buf = pstrdup(name);
|
||||
|
||||
ReleaseSysCache(tuple);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
if (array_base_type != InvalidOid && typlen < 0)
|
||||
{
|
||||
/* Switch our attention to the array element type */
|
||||
|
||||
Reference in New Issue
Block a user