Re: SQL99, CREATE CAST, and initdb

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: SQL99, CREATE CAST, and initdb
Дата
Msg-id Pine.LNX.4.44.0206232248220.929-100000@localhost.localdomain
обсуждение исходный текст
Ответ на Re: SQL99, CREATE CAST, and initdb  (Thomas Lockhart <lockhart@fourpalms.org>)
Список pgsql-hackers
Thomas Lockhart writes:

> It doesn't match perfectly in that one field is ignored as being
> (afaict) redundant for us. The basic definition from SQL99 is
>
> CREATE CAST(from AS to) WITH FUNCTION func(args) [AS ASSIGNMENT]
>
> I can map this to something equivalent to
>
> CREATE FUNCTION to(from) RETURNS to AS 'select func($1)' LANGUAGE 'sql';
>
> with another clause or two to get the implicit coersion enabled, and
> ignoring the "args" field(s).

I think this is wrong.  When you call CREATE CAST ... WITH FUNCTION
func(args)  then func(args) must already exist.  So the closest you could
map it to would be

ALTER FUNCTION to(from) IMPLICIT CAST

iff the name of the function and the target data type agree.  (Of course
this command doesn't exit, but you get the idea.)  The SQL99 feature is
more general than ours, but in order to use if effectively we would need
to maintain another index on pg_proc.  Tom Lane once opined that that
would be too costly.

-- 
Peter Eisentraut   peter_e@gmx.net





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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Index Scans become Seq Scans after VACUUM ANALYSE
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: A fairly obvious optimization?