Search Postgresql Archives

Alternate input for user defined data type

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I want to create a user defined data type but have flexible input just like, for example, the boolean data type where TRUE can 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 way to do this.? Is that what input_function is for in the CREATE TYPE command?  Do I need to create a trigger?




-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux