summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2008-07-30 17:05:05 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2008-07-30 17:05:05 +0000
commitbac3e83622b588eb449eb4e26c4b1e62e7cca3d5 (patch)
tree419f9079e41450aaaaa5ed0b8c8fa849a46d5bf9 /src/test
parentab9907f5e5eba6e4e17a279d07a1a9df21ec5b19 (diff)
Replace the hard-wired type knowledge in TypeCategory() and IsPreferredType()
with system catalog lookups, as was foreseen to be necessary almost since their creation. Instead put the information into two new pg_type columns, typcategory and typispreferred. Add support for setting these when creating a user-defined base type. The category column is just a "char" (i.e. a poor man's enum), allowing a crude form of user extensibility of the category list: just use an otherwise-unused character. This seems sufficient for foreseen uses, but we could upgrade to having an actual category catalog someday, if there proves to be a huge demand for custom type categories. In this patch I have attempted to hew exactly to the behavior of the previous hardwired logic, except for introducing new type categories for arrays, composites, and enums. In particular the default preferred state for user-defined types remains TRUE. That seems worth revisiting, but it should be done as a separate patch from introducing the infrastructure. Likewise, any adjustment of the standard set of categories should be done separately.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/create_type.out4
-rw-r--r--src/test/regress/sql/create_type.sql4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/test/regress/expected/create_type.out b/src/test/regress/expected/create_type.out
index 133ad857ac1..6ea1ceb6118 100644
--- a/src/test/regress/expected/create_type.out
+++ b/src/test/regress/expected/create_type.out
@@ -18,7 +18,9 @@ CREATE TYPE city_budget (
internallength = 16,
input = int44in,
output = int44out,
- element = int4
+ element = int4,
+ category = 'x', -- just to verify the system will take it
+ preferred = false -- ditto
);
-- Test creation and destruction of shell types
CREATE TYPE shell;
diff --git a/src/test/regress/sql/create_type.sql b/src/test/regress/sql/create_type.sql
index c6e391d8104..ec295e36e60 100644
--- a/src/test/regress/sql/create_type.sql
+++ b/src/test/regress/sql/create_type.sql
@@ -20,7 +20,9 @@ CREATE TYPE city_budget (
internallength = 16,
input = int44in,
output = int44out,
- element = int4
+ element = int4,
+ category = 'x', -- just to verify the system will take it
+ preferred = false -- ditto
);
-- Test creation and destruction of shell types