Re: Namespace issues - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: Namespace issues
Date
Msg-id 20060516180259.GI976@svana.org
Whole thread Raw
In response to Re: Namespace issues  (Don Y <pgsql@DakotaCom.Net>)
List pgsql-general
On Tue, May 16, 2006 at 10:53:10AM -0700, Don Y wrote:
> But what *binds* my C declaration to the corresponding SQL
> "CREATE CAST"?
>
> E.g.,
>
> CREATE FUNCTION foo_from_baz(baz)
> RETURNS foo
> AS '...'
> LANGUAGE 'C' IMMUTABLE STRICT;

Your create functions would look like:

CREATE FUNCTION foo(baz)
RETURNS foo
AS '$libdir/yourlib','cast_foo_from_baz'
LANGUAGE 'C' IMMUTABLE STRICT;

CREATE FUNCTION foo(baz2)
RETURNS foo
AS '$libdir/yourlib','cast_foo_from_baz2'
LANGUAGE 'C' IMMUTABLE STRICT;

> yet, to support the foo(baz) syntax, I would then need (?)
> to continue with:
>
> CREATE CAST (baz AS foo)
> WITH FUNCTION foo(baz);

Indeed, and also:

CREATE CAST (baz2 TO foo)
WITH FUNCTION foo(baz2)

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Attachment

pgsql-general by date:

Previous
From: Rafael Martinez
Date:
Subject: Re: Weird ..... (a=1 or a=2) <> (a=2 or a=1)
Next
From: "Michael Artz"
Date:
Subject: Partitioning on ip4 datatype using <<=