From: | Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> |
---|---|
To: | Marko Tiikkaja <marko(at)joh(dot)to>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: plpgsql.extra_warnings='num_into_expressions' |
Date: | 2014-08-21 10:19:25 |
Message-ID: | 53F5C7AD.7080402@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas 'ads' Scherbaum | 2014-08-21 10:23:56 | Re: documentation update for doc/src/sgml/func.sgml |
Previous Message | Amit Kapila | 2014-08-21 10:14:42 | Re: option -T in pg_basebackup doesn't work on windows |