Hi hackers,

Working on vectorized extension for Postgres (VOPS) I faced with two things in Postgres compiler which break my expectations and force me to abandon my original implementation plan. I wonder if it is really principle and correct that:


1. Moving-aggregate implementation should return the same type as plain implementation. Yes, in most cases it is hard to find arguments why them should return different types. But it is not true for vectorized operations...

2. Implicit user defined type casts are not applied for COALESCE operator:

    create  type complex as (x float8, y float8);
create function float2complex(x float8) returns complex as $$ declare complex c; begin c.x := x; x.y = 0; return c; $$ language plpgsql strict immutable; create cast (float8 as complex) with function float2complex(float8) as implicit;
    create table foo(c complex);
    select coalesce(c, 0.0) from foo;
    ERROR:  COALESCE types complex and numeric cannot be matched
    LINE 1: select coalesce(c, 0.0) from foo;

    select coalesce(c, 0.0::float8) from foo;
    ERROR:  COALESCE types complex and double precision cannot be matched
    LINE 1: select coalesce(c, 0.0::float8) from foo;

    select coalesce(c, 0.0::float8::complex) from foo;
     coalesce
    ----------
    (0 rows)

--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company



--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to