Re: plpgsql.extra_warnings='num_into_expressions'

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: plpgsql.extra_warnings='num_into_expressions'
Дата
Msg-id 53F5C7AD.7080402@vmware.com
обсуждение исходный текст
Ответ на Re: plpgsql.extra_warnings='num_into_expressions'  (Marko Tiikkaja <marko@joh.to>)
Ответы Re: plpgsql.extra_warnings='num_into_expressions'  (Marko Tiikkaja <marko@joh.to>)
Список pgsql-hackers
On 08/07/2014 01:11 AM, Marko Tiikkaja wrote:
> On 7/21/14, 10:56 PM, I wrote:
>> Here's a patch which allows you to notice those annoying bugs with INTO
>> slightly more quickly.  Adding to the next commit phest.
>
> New version, fixed bugs with set operations and VALUES lists.

Looks good.

It seems weird to pass a PLpgSQL_row struct to check_sql_expr. 
check_sql_expr only needs to know how many attributes is expected to be 
in the target list, so it would be more natural to just pass an "int 
expected_natts".

Once you do that, you could trivially also add checking for other cases, 
e.g:

do $$
declare  i int4;
begin  -- fails at runtime, because "SELECT 1,3" returns two attributes,  -- but FOR expects 1  for i in 1,3..(2) loop
 raise notice 'foo %', i;  end loop;
 
end;
$$;

There's probably more checking like that that you could add, but that 
can be done as add-on patches, if ever. The INTO mistake happens a lot 
more easily.

- Heikki




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

Предыдущее
От: Amit Kapila
Дата:
Сообщение: Re: option -T in pg_basebackup doesn't work on windows
Следующее
От: Andreas 'ads' Scherbaum
Дата:
Сообщение: Re: documentation update for doc/src/sgml/func.sgml