Re: Create Type with typmod_in

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: Create Type with typmod_in
Дата
Msg-id F8B81014-4F36-4192-8A73-E2A5B335F013@yahoo.com
обсуждение исходный текст
Ответ на Create Type with typmod_in  (Russell Keane <Russell.Keane@inps.co.uk>)
Список pgsql-sql
On Nov 4, 2011, at 10:01, Russell Keane <Russell.Keane@inps.co.uk> wrote:

I’m trying to create a custom type (PostgreSQL 9.0) which will essentially auto truncate a string to a certain length.

 


Can this be done purely in plpgsql?

If so, how?

 


An explicit cast of a value to varchar(n) causes the value to be truncated to n characters.

E.g.,  '1234567'::varchar(5) -> '12345'

How to integrate that knowledge into a type I do not know.

David J.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Russell Keane
Дата:
Сообщение: Create Type with typmod_in
Следующее
От: John Fabiani
Дата:
Сообщение: the use of $$string$$