Re: proposal: early casting in plpgsql

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: early casting in plpgsql
Date: 2009-05-28 18:57:33
Message-ID: 162867790905281157o22effb77sbf37fbf7255e35c5@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2009/5/28 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
>> I propose for types with typmod -1 early casting - etc casting to
>> target type on planner level. We cannot use this method for defined
>> typmod, because we would to raise exception for following situation:
>
> What existing coding habits will this break?

I don't know about any. Actually we don't have "variant datatype", so
this should not impact on existing applications.

 People have long been
> accustomed to use plpgsql for end-runs around SQL casting behavior,
> so I'm not really convinced by the idea that "make it more like SQL"
> is automatically a good thing.
>

for typmod others then -1 we should to use IO cast - but we should to
check, if it's one from known casts.

without "strict mode" this should be fully compatible (if we could to
expect so our casting functions are correct).

> Also, it seems bizarre and inconsistent that it would work one way
> for variables with a typmod and an entirely different way for those
> without.  How will you explain that to users who never heard of a
> typmod?
>

Now I thing so this should be solved well too. We need two kind of
casting functions - what we have - CASTs with INOUT and CASTs with
functions. For variables with typmod we have to call CASTs with INOUT.

>                        regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Field 2009-05-28 19:03:10 plperl error format vs plpgsql error format vs pgTAP
Previous Message Josh Berkus 2009-05-28 18:41:47 Re: sun blade 1000 donation