[HACKERS] Two questions about Postgres parser

Поиск
Список
Период
Сортировка
От Konstantin Knizhnik
Тема [HACKERS] Two questions about Postgres parser
Дата
Msg-id f3c9d019-d12e-3f2b-1aea-73747e660513@postgrespro.ru
обсуждение исходный текст
Ответы Re: [HACKERS] Two questions about Postgres parser  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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
numericcannot 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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: [HACKERS] bytea_output output of base64
Следующее
От: David Steele
Дата:
Сообщение: Re: [HACKERS] Creation of "Future" commit fest, named 2017-07