Re: [HACKERS] casting & type comments

From: Brett McCormick <brett(at)work(dot)chicken(dot)org>
To: dg(at)illustra(dot)com (David Gould)
Cc: pgsql-hackers(at)hub(dot)org
Subject: Re: [HACKERS] casting & type comments
Date: 1998-03-13 23:41:29
Message-ID: 13577.50044.830780.683436@abraxas.scene.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 13 March 1998, at 15:19:24, David Gould wrote:

> > What do you all think about the fact that cast(anytype as varchar)
> > results in a call to a procedure that is not creatable with 'create
> > function'?
>
> Not too nice...
>
> > Perhaps we should re-think our casting implementation,
> > maybe one that isn't based on just rewriting itself into a function
> > call :) If I wanted to call a function, I would :)
>
> But, this is the real strength of Postgres, everything is treated uniformly
> and everything can be extended by defining functions. To hardcode certain
> types would be to lose the one of the most creative and desireable aspects
> of the system.

I'm certainly not saying that this aspect of the postgres system
should be changed, but rather a different way of mapping casts to
functions, so we don't run into problems like this, and perhaps a
fall-back to a straight string cast (i.e. call the destination types
input function on the return value of the source types output
function)..

One downside to all this is if I already have a function called
whatever, and suddenly someone wants to add a type called whatever,
that function would be used for casting when it really shouldn't, and
could have unexpected results..

--brett

>
> > I can, however, do a create function with a different name, then
> > update that to varchar. the reason I can't, of course, is because the
> > grammar expects varchar(number), not varchar(argument types)..
>
> Perhaps the grammar could be fixed to allow this?
>
> -dg
>
> David Gould dg(at)illustra(dot)com 510.628.3783 or 510.305.9468
> Informix Software (No, really) 300 Lakeside Drive Oakland, CA 94612
> - I realize now that irony has no place in business communications.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-03-13 23:57:25 Re: [HACKERS] Postgresql v6.3 for Alpha Digital Unix
Previous Message Brett McCormick 1998-03-13 23:33:30 Re: [HACKERS] suspected problem with cache updates