Re: deleting function

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: pavunkumar <pavun(dot)bks(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: deleting function
Date: 2009-04-24 20:20:26
Message-ID: 49F21F0A.8070604@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 24/04/2009 14:03, pavunkumar wrote:
> create or replace function newd(id integer ) returns void as $$
> begin
> delete from testing where id=$1;
> end;

I'd guess it's because the column name, "id", is the same as the
argument name - plpgsql thinks that "id" in the DELETE statement is the
argument, so in effect you're doing -

delete from testing where true;

- with the results you saw. Give the argument a different name and you
should be OK.

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Decibel! 2009-04-24 20:54:01 Re: Determining the names of columns in a dynamic query
Previous Message Decibel! 2009-04-24 20:05:35 Can't use "any" with SQL functions