From 7df49cef7258d06a7db819d7b5025d131cc226a2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 30 Jul 2008 19:35:13 +0000 Subject: Flip the default typispreferred setting from true to false. This affects only type categories in which the previous coding made *every* type preferred; so there is no change in effective behavior, because the function resolution rules only do something different when faced with a choice between preferred and non-preferred types in the same category. It just seems safer and less surprising to have CREATE TYPE default to non-preferred status ... --- doc/src/sgml/ref/create_type.sgml | 8 ++++---- doc/src/sgml/typeconv.sgml | 16 ++-------------- 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/ref/create_type.sgml b/doc/src/sgml/ref/create_type.sgml index 8002e2c4b9c..665bc805af8 100644 --- a/doc/src/sgml/ref/create_type.sgml +++ b/doc/src/sgml/ref/create_type.sgml @@ -1,5 +1,5 @@ @@ -535,9 +535,9 @@ CREATE TYPE name True if this type is a preferred type within its type category, - else false. The default is true (which is appropriate for - all entries in category U, but is usually not - appropriate for new types in other categories — beware!). + else false. The default is false. Be very careful about creating + a new preferred type within an existing type category, as this + could cause surprising changes in behavior. diff --git a/doc/src/sgml/typeconv.sgml b/doc/src/sgml/typeconv.sgml index c9f96323f30..08b62c4e61a 100644 --- a/doc/src/sgml/typeconv.sgml +++ b/doc/src/sgml/typeconv.sgml @@ -1,4 +1,4 @@ - + Type Conversion @@ -160,25 +160,13 @@ categories, including boolean, numeric, timespan, geometric, network, and user-defined. (For a list see ; but note it is also possible to create custom type categories.) Within each -category there are one or more preferred types, which +category there can be one or more preferred types, which are preferentially selected when there is ambiguity. With careful selection of preferred types and available implicit casts, it is possible to ensure that ambiguous expressions (those with multiple candidate parsing solutions) can be resolved in a useful way. - - - For what are now historical reasons, types in the user-defined - category are normally always marked as preferred. Since all types - in this category are preferred, the heuristic that favors preferred types - accomplishes nothing, and thus this situation is equivalent to treating them - all as non-preferred. The preferred marking is useful within the - system-defined type categories, and can be useful within custom type - categories. - - - All type conversion rules are designed with several principles in mind: -- cgit v1.2.3