Hello,

Check out this simple alias:

-----------------------------------------
CREATE ALIAS show AS $$
String showme(String value)
{
  return value;
}
$$;
-----------------------------------------

When created, it can be found in the INFORMATION_SCHEMA.ALIASES table:

-----------------------------------------
select * from information_schema.function_aliases where alias_name = 'SHOW';
-----------------------------------------

Its result data type is 12, which stands for JDBC's VARCHAR type code. When
I select that data type in type_info, however, I get two results:

-----------------------------------------
select type_name from information_schema.type_info where data_type = 12;

-- returns
VARCHAR
VARCHAR_IGNORECASE
-----------------------------------------

I guess, the ALIASES view should also contain a type_name field, to
unambiguously reference a type_info entry...? Or how can it be done? The
following query shows that three data_types are actually ambiguously
defined, with H2-specific data type "overloads":

-----------------------------------------
select i1.type_name, i1.data_type , i2.c as "duplicates"
from information_schema.type_info i1
join (
 select data_type , count(*)  c
 from information_schema.type_info
 group by data_type
 having count(*) > 1
) i2 on i1.data_type = i2.data_type;

-- returns
TYPE_NAME          DATA_TYPE   duplicates
VARCHAR            12          2
VARCHAR_IGNORECASE 12          2
BIGINT             -5          2
IDENTITY           -5          2
BINARY             -2          2
UUID               -2          2
-----------------------------------------

Cheers
Lukas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to