![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX and Linux Applications Discuss UNIX and Linux software applications. This includes SQL, Databases, Middleware, MOM, SOA, EDA, CEP, BI, BPM and similar topics. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Return an array of strings from user defined function in awk | user_prady | Shell Programming and Scripting | 2 | 12-04-2007 12:03 AM |
| need help with User Defined Function | user_prady | Shell Programming and Scripting | 11 | 11-18-2007 08:51 PM |
| Very Strange Behavior for redirection | cahook | Shell Programming and Scripting | 5 | 08-08-2007 11:32 AM |
| Nawk user-defined function | NewbieGirl | Shell Programming and Scripting | 1 | 06-20-2003 10:51 AM |
| strange sed behavior | Kevin Pryke | UNIX for Dummies Questions & Answers | 5 | 06-13-2003 04:34 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
strange behavior of PSQL user defined function
Segregated the problematic portion, and showing for your view here.,
1. Following is the function definition, Code:
create or replace function new_del(id integer) returns void as $$
begin
raise info 'dollar :%',$1;
delete from testing where id=$1;
end ;
$$
language 'plpgsql';
Code:
SELECT * from testing ; id ----- 101 102 103 (3 rows) 3. When i call the function as Code:
SELECT new_del('101');
INFO: dollar :101
new_del
---------
(1 row)
4. But when i change the name of the argument then the function behaves normally. I changed the argument name "id" to id_field it behaved normally and deletes only the specified row. Any help is appreciated. |
|
||||
|
My friend too tried finding solution, and found it.
It is, Where ever the argument occurs, it is being replaced with the $ value. That is "id" is replaced with $1 in the query so the query becomes, Code:
delete from testing where $1 = $1 Thanks for all the people who tried to find the problem in it. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|