Re: [GENERAL] deleting function

2009-04-28 Thread Raymond O'Donnell
On 28/04/2009 10:56, Jasen Betts wrote: > would this: > > delete from testing where "id"=$1; > > be safe? No - you haven't really changed anything - the double-quotes just prevent Postgres folding mixed/upper-case identifiers to lower-case. Why not just change the name of the argument as othe

Re: [GENERAL] deleting function

2009-04-28 Thread Jasen Betts
On 2009-04-24, Tom Lane wrote: > pavunkumar 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 nam

Re: [GENERAL] deleting function

2009-04-26 Thread Sam Mason
On Fri, Apr 24, 2009 at 08:19:37PM -0700, pavunkumar wrote: > On Apr 24, 8:55 pm, t...@sss.pgh.pa.us (Tom Lane) wrote: > > 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 everyt

Re: [GENERAL] deleting function

2009-04-25 Thread Merlin Moncure
On Fri, Apr 24, 2009 at 12:15 PM, Sam Mason wrote: > On Fri, Apr 24, 2009 at 11:55:48AM -0400, Tom Lane wrote: >> pavunkumar writes: >> > create or replace function newd(id integer ) returns void as $$ >> > delete from testing where id=$1; >> >> Don't use the same name for a parameter as you use

Re: [GENERAL] deleting function

2009-04-25 Thread Alban Hertroys
On Apr 25, 2009, at 5:19 AM, pavunkumar wrote: Dear Friend Whatever your saying right , But why the function not saying error ? that is my doubt... this is what I want to clarify! Because it's a valid comparison, just not the one you wanted. Alban

Re: [GENERAL] deleting function

2009-04-24 Thread pavunkumar
On Apr 24, 8:55 pm, t...@sss.pgh.pa.us (Tom Lane) wrote: > pavunkumar writes: > > create or replace function newd(id integer ) returns void as $$ > > ^^> begin > > delete from testing where id=$1; > > ^^ > > > end; > > $$ > > language '

Re: [GENERAL] deleting function

2009-04-24 Thread Raymond O'Donnell
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 argume

Re: [GENERAL] deleting function

2009-04-24 Thread Tom Lane
pavunkumar 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 colu

Re: [GENERAL] deleting function

2009-04-24 Thread Sam Mason
On Fri, Apr 24, 2009 at 11:55:48AM -0400, Tom Lane wrote: > pavunkumar writes: > > create or replace function newd(id integer ) returns void as $$ > > delete from testing where id=$1; > > Don't use the same name for a parameter as you use for a table column > referenced in the function. I've fou

[GENERAL] deleting function

2009-04-24 Thread pavunkumar
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 " selec

Re: [GENERAL] deleting function from pg_catalog.pg_proc

2006-03-28 Thread Martijn van Oosterhout
On Tue, Mar 28, 2006 at 02:58:45PM +0200, Gevik Babakhani wrote: > Hello Folks, > > I would like to know if deleting functions from pg_catalog.pg_proc with > the following SQL statement is advisable? Offhand I think you're going to run into problem like the dependancies not being removed which co

[GENERAL] deleting function from pg_catalog.pg_proc

2006-03-28 Thread Gevik Babakhani
Hello Folks, I would like to know if deleting functions from pg_catalog.pg_proc with the following SQL statement is advisable? I would like a way of deleting my functions without using the DROP FUNCTION statement. -- delete from pg_