strange behavior of PSQL user defined function

Segregated the problematic portion, and showing for your view here.,

  1. Following is the function definition,
create or replace function new_del(id integer) returns void as $$
begin
    raise info 'dollar :%',$1;
    delete from testing  where id=$1;
    end ;
$$
language 'plpgsql';
  1. following is the table "testing" contains,
SELECT * from testing ;
 id
-----
 101
 102
 103
(3 rows)
  1. When i call the function as
SELECT new_del('101');
INFO:  dollar :101
 new_del
---------

(1 row)

It deletes all the rows ! Why it is doing like this !

  1. But when i change the name of the argument then the function behaves normally.

I changed the argument name "id" to id_field it behaved normally and deletes only the specified row.

Any help is appreciated.

My friend too tried finding solution, and found it.

It is,
Where ever the argument occurs, it is being replaced with the $ value. That is "id" is replaced with $1 in the query so the query becomes,

delete from testing where $1 = $1

So it deletes all the specified rows.
Thanks for all the people who tried to find the problem in it.