deleting function

From: pavunkumar <pavun(dot)bks(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: pavun(dot)bks(at)gmail(dot)com
Subject: deleting function
Date: 2009-04-24 13:03:45
Message-ID: 58f0db82-50e0-4c63-a5d9-8640ac61ac34@s1g2000prd.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Dear Friends

I have table called below
I need to delete the record by using id value of the table
For that I wrote below function

create or replace function newd(id integer ) returns void as $$
begin
delete from testing where id=$1;
end;
$$
language 'plpgsql';

Here I call the function as " select newd(100) "

But it is deleting every things from the table

My doubt is , why it was deleting every thing , even I gave the
single value in function .

pavunkumar=> \d testing;
Table "hospital.testing"
Column | Type | Modifiers
---------+-------------------+-----------
id | integer | not null
name | character varying |
address | character varying |
Indexes:
"testing_pkey" PRIMARY KEY, btree (id)

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2009-04-24 14:04:02 Re: need help for PostgreSQL consistency check mechanism
Previous Message Daniel Verite 2009-04-24 12:49:03 Re: standard_conforming_strings and pg_escape_string()