Re: deleting function - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: deleting function
Date
Msg-id 49F21F0A.8070604@iol.ie
Whole thread Raw
In response to deleting function  (pavunkumar <pavun.bks@gmail.com>)
List 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@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

pgsql-general by date:

Previous
From: Decibel!
Date:
Subject: Can't use "any" with SQL functions
Next
From: Decibel!
Date:
Subject: Re: Determining the names of columns in a dynamic query