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

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to