Namespace issues

Поиск
Список
Период
Сортировка
От Don Y
Тема Namespace issues
Дата
Msg-id 446A0BF7.5020009@DakotaCom.Net
обсуждение исходный текст
Ответы Re: Namespace issues  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
Given a user defined type foo...
I've created several casts to/from foo and built-in types.
I had adopted a naming convention of:
   baz foo_to_baz(foo);
   foo foo_from_baz(baz);

But:

   ...it is recommended that you continue to follow this old
   convention of naming cast implementation functions after
   the target data type. Many users are used to being able to
   cast data types using a function-style notation, that is
   typename(x). This notation is in fact nothing more nor less
   than a call of the cast implementation function; it is not
   specially treated as a cast. If your conversion functions
   are not named to support this convention then you will have
   surprised users. Since PostgreSQL allows overloading of the
   same function name with different argument types, there is no
   difficulty in having multiple conversion functions from
   different types that all use the target type’s name.

This suggests:
   baz baz(foo);
   foo foo(baz);

I don't see how I can do this in my declarations.  E.g.,
if I have
   baz = {int4, text, float8, ...}
then I end up with several (C) functions all named foo()
but each taking a different argument type (baz).  Since
C doesn't support more than a single namespace for functions,
this just won't work.

What am I failing to see, here?

Thanks!
--don

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Weird ..... (a=1 or a=2) <> (a=2 or a=1)
Следующее
От: Don Y
Дата:
Сообщение: Re: error handling in cast functions for user defined types