Alternate input for user defined data type - Mailing list pgsql-general

From Aram Fingal
Subject Alternate input for user defined data type
Date
Msg-id A252EAE6-944F-44A5-9D9B-0CCE188AD9DC@multifactorial.com
Whole thread Raw
Responses Re: Alternate input for user defined data type  (Albe Laurenz <laurenz.albe@wien.gv.at>)
List pgsql-general
I want to create a user defined data type but have flexible input just like, for example, the boolean data type where
TRUEcan be entered as any of (TRUE, true, T, t, YES, yes, Y, y, 1...) and it will be interpreted as the same thing.   

So suppose I have days of the week:

CREATE TYPE  days_of_week AS ENUM ('Su','M','Tu','W','Th','F','Sa');

Except that I want 'MON', 'Mon', 'mon' and 'monday' all to be interpreted as 'M' in the data type.  What is the best
wayto do this.? Is that what input_function is for in the CREATE TYPE command?  Do I need to create a trigger? 




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg_extension_config_dump() with a sequence
Next
From: "andres.pascal"
Date:
Subject: Re: Fastest Index/Algorithm to find similar sentences