Re: deleting function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pavunkumar <pavun(dot)bks(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: deleting function
Date: 2009-04-24 15:55:48
Message-ID: 26724.1240588548@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

pavunkumar <pavun(dot)bks(at)gmail(dot)com> writes:
> create or replace function newd(id integer ) returns void as $$
^^
> begin
> delete from testing where id=$1;
^^
> end;
> $$
> language 'plpgsql';

Don't use the same name for a parameter as you use for a table column
referenced in the function. The above is equivalent to
"delete... where $1=$1", ie, delete everything.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2009-04-24 15:56:45 Re: feature suggestion and return to pgsql-general :-)
Previous Message Joshua D. Drake 2009-04-24 15:03:14 Re: need help for PostgreSQL consistency check mechanism