Search Postgresql Archives

Namespace issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux