Override system-defined cast?

Поиск
Список
Период
Сортировка
От Peter
Тема Override system-defined cast?
Дата
Msg-id 452E0878.7060503@greatnowhere.com
обсуждение исходный текст
Ответы Re: Override system-defined cast?  (David Fetter <david@fetter.org>)
Список pgsql-general
Is there any way I can override system-defined casts?

Tried

create cast (varchar as timestamptz) with function
user_timestamptz(varchar) ;

and got

ERROR:  cast from type pg_catalog.varchar to type timestamptz already exists

DROP CAST does not work:

ERROR:  cannot drop cast from character varying to timestamp with time
zone because it is required by the database system

(or are my permissions insufficient?)

Basically my problem is converting '' (empty string) to
NULL::timestampz, and built-in cast cannot convert blank string to
timestamptz. Maybe I'm wondering up the wrong alley with casts?

One solution I can see is create user-defined type (which would be the
same timestamptz) and define varchar->mytype cast, but that will require
rather extensive changes to database schema. Plus, our user-interface
currently relies on PG datatypes to format input/output data.


Any suggestions?

TIA,
Peter

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

Предыдущее
От: "Dawid Kuroczko"
Дата:
Сообщение: Re: more anti-postgresql FUD
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: STABLE functions