Re: Polymorphic functions' weird behavior

Lists: pgsql-general
From: "Vyacheslav Kalinin" <vka(at)ipcb(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Polymorphic functions' weird behavior
Date: 2007-07-31 23:33:20
Message-ID: web-4943026@buymin.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Tom Lane wrote:
> The fix is pretty easy if you need it now

Thanks for the update, Tom.
Another little issue with that function. I cannot make it
accept NULL as an argument. It won't normally accept NULL
reporting an appropriate error that it cannot determine
argument type, nor will it accept it if I make the
function STRICT, nor can I handle it inside the function
since it isn't actually called. Thus I always get the
error which is not desirable behavior. Any way around it?

regards, Viatcheslav


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Vyacheslav Kalinin" <vka(at)ipcb(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Polymorphic functions' weird behavior
Date: 2007-08-01 01:51:07
Message-ID: 15600.1185933067@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

"Vyacheslav Kalinin" <vka(at)ipcb(dot)net> writes:
> Another little issue with that function. I cannot make it
> accept NULL as an argument.

You'd have to cast the NULL to some specific array type.

regards, tom lane


From: Viatcheslav Kalinin <vka(at)ipcb(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Polymorphic functions' weird behavior
Date: 2007-08-01 12:20:34
Message-ID: 46B07A92.9090002@ipcb.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general

Tom Lane wrote:
>
> You'd have to cast the NULL to some specific array type.
>
> regards, tom lane
Unfortunately I can't do that (well, in fact it would be pretty
inconvenient) because the function is called from other plpgsql function
and I cannot be sure if it will be called with NULL or not. Anyway I
seem to resolved the problem by writing another doing-nothing-at-all
function with the same name and "unknown' argument type.

regards, Viatcheslav