Routine resolution with two different distinct data types

The candidate list can contain a routine with a parameter that is the source data type of the invoked routine argument. If the source type is itself a distinct type, the database server checks the source type of that distinct type. However, if the source type is not in the precedence list for that data type, the routine-resolution process eliminates that candidate.

For example, suppose you create the following distinct data types and table:
CREATE DISTINCT TYPE pounds AS INT;
CREATE DISTINCT TYPE stones AS INT;
CREATE TABLE test(p pounds, s stones);
The following figure shows a sample query that an SQL user might execute.
Figure 1: Sample distinct type invocation
SELECT * FROM test WHERE p=s;

Although the source data types of the two arguments are the same, this query fails because p and s are different distinct data types. The equal() function cannot compare these two different data types.