Re: [HACKERS] casting & type comments

Поиск
Список
Период
Сортировка
От Thomas G. Lockhart
Тема Re: [HACKERS] casting & type comments
Дата
Msg-id 350D45C9.FFD3B9EE@alumni.caltech.edu
обсуждение исходный текст
Ответ на Re: [HACKERS] casting & type comments  (sferac@bo.nettuno.it)
Список pgsql-hackers
> I agree with you.
> Many databases as SOLID and MySQL don't have CAST statement because
> they don't need it.

They would need it if they were SQL92 conformant :)

> Unfortunately we need a CAST statement to convert data from one to
> another type but it is incomplete, seems that CAST can translate only
> a few types like:
>         int to float
>         float to int
>         int to text
>         float to text
>
> We can't CAST a char to a varchar, for example.
> It would be interesting al least to have a list of possible
> conversions.

The only thing lacking is for someone to go through and implement more
of the conversion functions. In conjunction with the improvements I
would like to do for automatic type conversion in the parser, this would
give us a more complete "transparent" conversion capability. CAST uses
the same underlying functions, but allows you to force the resultant
type, overriding any automatic conversion.

I tried selecting a list of all possible conversions, and narrowed it
down to 218 entries. But most are not actual straight conversions...

  select proname, prorettype, proargtypes
  from pg_proc
  where pronargs = 1
    and proname not like '%in'
    and proname not like '%out'

                     - Tom

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] DEC Alpha initdb partial fix
Следующее
От: The Hermit Hacker
Дата:
Сообщение: First mega-patch...