From shyamperi@davlin.co.in Sat Sep 20 06:49:41 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 49242D1B53F; Sat, 20 Sep 2003 06:49:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 81271-01; Sat, 20 Sep 2003 03:49:07 -0300 (ADT) Received: from davlin.co.in (ns.vasnet.net.in [202.4.160.11]) by svr1.postgresql.org (Postfix) with ESMTP id A5920D1B4E5; Sat, 20 Sep 2003 03:49:04 -0300 (ADT) Received: from Application (unknown [202.4.160.30]) by davlin.co.in (Postfix) with ESMTP id B85AE14B70; Sat, 20 Sep 2003 11:54:34 +0530 (IST) Message-ID: <2753631.1064039518784.JavaMail.tomcat@mail.davlin.co.in> From: shyamperi@davlin.co.in To: pgsql-admin@postgresql.org To: pgsql-sql@postgresql.org Subject: Error with functions Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_163_7194891.1064039518632" Date: Sat, 20 Sep 2003 11:54:34 +0530 (IST) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/326 X-Sequence-Number: 10414 ------=_Part_163_7194891.1064039518632 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hey, create or replace function sample(varchar,int) returns varchar as' declare data alias for $1; size alias for $2; begin return substr(data,(length(data)-size)+1,length(data)); end; ' language 'plpgsql'; ____________________________ WARNING: plpgsql: ERROR during compile of sample near line 2 ERROR: parse error at or near ";" Can any body tell me why is this error coming ----- Warm Regards Sh=FFam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003=20 Ph : 91-824-2451001/5 Fax : 91-824-2451050=20 DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_163_7194891.1064039518632 Content-type: text/html Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=Untitled1

Hey,
create or replace function s= ample(varchar,int) returns varchar as'
declare
   &nbs= p;    data alias for $1;
     &n= bsp;  size alias for $2;
begin
     &nb= sp;  return  substr(data,(length(data)-size)+1,length(data));
= end;
' language 'plpgsql';

____________________________
WARNING:&n= bsp; plpgsql: ERROR during compile of sample near line 2
ERROR:  pa= rse error at or near ";"

Can any body tell me why is this error comi= ng

-----
Warm Regards
Sh=FFam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003=20
Ph : 91-824-2451001/5
Fax : 91-824-2451050=20




DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_163_7194891.1064039518632-- From jasiek@klaster.net Sat Sep 20 06:59:50 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 3D314D1B52A for ; Sat, 20 Sep 2003 06:59:50 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 70642-10 for ; Sat, 20 Sep 2003 03:59:16 -0300 (ADT) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by svr1.postgresql.org (Postfix) with ESMTP id CDC4CD1B4E5 for ; Sat, 20 Sep 2003 03:59:13 -0300 (ADT) Received: from klaster.net (core-1.citynet.pl [80.48.135.69]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 258272B3D5; Sat, 20 Sep 2003 08:58:52 +0200 (CEST) Message-ID: <3F6BFAB0.2010106@klaster.net> Date: Sat, 20 Sep 2003 08:58:56 +0200 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; pl-PL; rv:1.5a) Gecko/20030718 X-Accept-Language: pl, en-us, en MIME-Version: 1.0 To: shyamperi@davlin.co.in Cc: pgsql-sql@postgresql.org Subject: Re: Error with functions References: <2753631.1064039518784.JavaMail.tomcat@mail.davlin.co.in> In-Reply-To: <2753631.1064039518784.JavaMail.tomcat@mail.davlin.co.in> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/215 X-Sequence-Number: 15193 > Hey, > create or replace function sample(varchar,int) returns varchar as' > declare > data alias for $1; > size alias for $2; > begin > return substr(data,(length(data)-size)+1,length(data)); > end; > ' language 'plpgsql'; > ____________________________ > WARNING: plpgsql: ERROR during compile of sample near line 2 > ERROR: parse error at or near ";" > > Can any body tell me why is this error coming Really? I got no error and select sample('nothing',3) gave mi 'ing' What is your postgresql version? Regards, Tomasz Myrta From jeanmichel.chabanne@free.fr Sat Sep 20 07:26:04 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 51734D1B4E5; Sat, 20 Sep 2003 07:26:04 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 84535-06; Sat, 20 Sep 2003 04:25:33 -0300 (ADT) Received: from postfix4-1.free.fr (postfix4-1.free.fr [213.228.0.62]) by svr1.postgresql.org (Postfix) with ESMTP id 435F8D1B53F; Sat, 20 Sep 2003 04:25:31 -0300 (ADT) Received: from free.fr (lns-p19-9-62-147-243-253.adsl.proxad.net [62.147.243.253]) by postfix4-1.free.fr (Postfix) with ESMTP id 56D6B4C6C4; Sat, 20 Sep 2003 09:25:10 +0200 (CEST) Message-ID: <3F6C01D4.7090000@free.fr> Date: Sat, 20 Sep 2003 09:29:24 +0200 From: Jean-Michel Chabanne User-Agent: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.3.1) Gecko/20030428 X-Accept-Language: fr, en-us, en MIME-Version: 1.0 To: shyamperi@davlin.co.in Cc: pgsql-admin@postgresql.org, pgsql-sql@postgresql.org Subject: Re: Error with functions References: <2753631.1064039518784.JavaMail.tomcat@mail.davlin.co.in> In-Reply-To: <2753631.1064039518784.JavaMail.tomcat@mail.davlin.co.in> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/327 X-Sequence-Number: 10415 shyamperi@davlin.co.in a écrit : >Hey, >create or replace function sample(varchar,int) returns varchar as' >declare > data alias for $1; > size alias for $2; >begin > return substr(data,(length(data)-size)+1,length(data)); >end; >' language 'plpgsql'; >____________________________ >WARNING: plpgsql: ERROR during compile of sample near line 2 >ERROR: parse error at or near ";" > >Can any body tell me why is this error coming >----- >Warm Regards >Shÿam Peri > >II Floor, Punja Building, >M.G.Road, >Ballalbagh, >Mangalore-575003 >Ph : 91-824-2451001/5 >Fax : 91-824-2451050 > > >DISCLAIMER: This message contains privileged and confidential information and is >intended only for the individual named.If you are not the intended >recipient you should not disseminate,distribute,store,print, copy or >deliver this message.Please notify the sender immediately by e-mail if >you have received this e-mail by mistake and delete this e-mail from >your system. > > > ------------------------------------------------------------------------ > > Hey, > create or replace function sample(varchar,int) returns varchar as' > declare > data alias for $1; > size alias for $2; > begin > return substr(data,(length(data)-size)+1,length(data)); > end; > ' language 'plpgsql'; > > ____________________________ > WARNING: plpgsql: ERROR during compile of sample near line 2 > ERROR: parse error at or near ";" > > Can any body tell me why is this error coming > >----- >Warm Regards >Shÿam Peri > >II Floor, Punja Building, >M.G.Road, >Ballalbagh, >Mangalore-575003 >Ph : 91-824-2451001/5 >Fax : 91-824-2451050 > > > > > > > * DISCLAIMER: This message contains privileged and confidential > information and is intended only for the individual named.If you are > not the intended recipient you should not > disseminate,distribute,store,print, copy or deliver this > message.Please notify the sender immediately by e-mail if you have > received this e-mail by mistake and delete this e-mail from your system.* > >------------------------------------------------------------------------ > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > > Hi, I juste did a copy/paste of your sample on my test DB. I didn't get any error message and the function works fine. I run PostgreSQL 7.3.3 -- Jean-Michel Chabanne 77450 MONTRY (FRANCE) 48" 54' N - 2" 49' E Powered by Linux From shyamperi@davlin.co.in Sat Sep 20 11:41:11 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AF2AFD1B584; Sat, 20 Sep 2003 11:41:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 31439-04; Sat, 20 Sep 2003 08:41:03 -0300 (ADT) Received: from davlin.co.in (ns.vasnet.net.in [202.4.160.11]) by svr1.postgresql.org (Postfix) with ESMTP id C3A0DD1B57E; Sat, 20 Sep 2003 08:40:58 -0300 (ADT) Received: from Application (unknown [202.4.160.30]) by davlin.co.in (Postfix) with ESMTP id F1AEF14B78; Sat, 20 Sep 2003 16:46:27 +0530 (IST) Message-ID: <7144314.1064057032072.JavaMail.tomcat@mail.davlin.co.in> From: shyamperi@davlin.co.in To: jeanmichel.chabanne@free.fr Subject: Re: Error with functions Cc: pgsql-admin@postgresql.org Cc: pgsql-sql@postgresql.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_274_664745.1064057031920" Date: Sat, 20 Sep 2003 16:46:28 +0530 (IST) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/328 X-Sequence-Number: 10416 ------=_Part_274_664745.1064057031920 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 5:08p Dear All, When I am executing any function with parameter.. I am unable to access the= m. So, I would be thankful if, anyone can help me in teaching this aspect. CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN $1 + 1; END; ' LANGUAGE 'plpgsql'; The expected ouput of the above function should be 11 when we pass the 10 t= o it.... but it returns 1. Thank you in advance ----- Warm Regards Sh=FFam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003=20 Ph : 91-824-2451001/5 Fax : 91-824-2451050=20 ----------------Original Message------------------ shyamperi@davlin.co.in a =E9crit : >Hey, >create or replace function sample(varchar,int) returns varchar as' >declare > data alias for $1; > size alias for $2; >begin > return substr(data,(length(data)-size)+1,length(data)); >end; >' language 'plpgsql'; >____________________________ >WARNING: plpgsql: ERROR during compile of sample near line 2 >ERROR: parse error at or near ";" > >Can any body tell me why is this error coming >----- >Warm Regards >Sh=FFam Peri > >II Floor, Punja Building, >M.G.Road, >Ballalbagh, >Mangalore-575003=20 >Ph : 91-824-2451001/5 >Fax : 91-824-2451050=20 > > >DISCLAIMER: This message contains privileged and confidential information and is >intended only for the individual named.If you are not the intended >recipient you should not disseminate,distribute,store,print, copy or >deliver this message.Please notify the sender immediately by e-mail if >you have received this e-mail by mistake and delete this e-mail from >your system. > > > ------------------------------------------------------------------------ > > Hey, > create or replace function sample(varchar,int) returns varchar as' > declare > data alias for $1; > size alias for $2; > begin > return substr(data,(length(data)-size)+1,length(data)); > end; > ' language 'plpgsql'; > > ____________________________ > WARNING: plpgsql: ERROR during compile of sample near line 2 > ERROR: parse error at or near ";" > > Can any body tell me why is this error coming > >----- >Warm Regards >Sh=FFam Peri > >II Floor, Punja Building, >M.G.Road, >Ballalbagh, >Mangalore-575003=20 >Ph : 91-824-2451001/5 >Fax : 91-824-2451050=20 > > >=20=20 > > > > * DISCLAIMER: This message contains privileged and confidential=20 > information and is intended only for the individual named.If you are > not the intended recipient you should not=20 > disseminate,distribute,store,print, copy or deliver this=20 > message.Please notify the sender immediately by e-mail if you have=20 > received this e-mail by mistake and delete this e-mail from your system.* > >------------------------------------------------------------------------ > > >---------------------------(end of broadcast)--------------------------- >TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org >=20=20 > Hi, I juste did a copy/paste of your sample on my test DB. I didn't get any=20 error message and the function works fine. I run PostgreSQL 7.3.3 --=20 Jean-Michel Chabanne 77450 MONTRY (FRANCE) 48" 54' N - 2" 49' E Powered by Linux DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_274_664745.1064057031920 Content-type: text/html Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=Untitled1

5:08p
Dear All,
When I am executing any function with parame= ter.. I am unable to access them. So, I would be thankful if, anyone can he= lp me in teaching this aspect.

CREATE FUNCTION add_one (integer) RET= URNS INTEGER AS '
    BEGIN
    &n= bsp;   RETURN $1 + 1;
    END;
' LANGUAGE 'p= lpgsql';

The expected ouput of the above function should be 11 when we pass the 1= 0 to it.... but it returns 1.
Thank you in advance

-----
Warm Regards
Sh=FFam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003=20
Ph : 91-824-2451001/5
Fax : 91-824-2451050=20




----------------Original Message------------------
sh=
yamperi@davlin.co.in a =E9crit :

>Hey,
>create or replace function sample(varchar,int) returns varchar as'
>declare
>        data alias for $1;
>        size alias for $2;
>begin
>        return  substr(data,(length(data)-size)+1,length(data));
>end;
>' language 'plpgsql';
>____________________________
>WARNING:  plpgsql: ERROR during compile of sample near line 2
>ERROR:  parse error at or near ";"
>
>Can any body tell me why is this error coming
>-----
>Warm Regards
>Sh=FFam Peri
>
>II Floor, Punja Building,
>M.G.Road,
>Ballalbagh,
>Mangalore-575003=20
>Ph : 91-824-2451001/5
>Fax : 91-824-2451050=20
>
>
>DISCLAIMER: This message contains privileged and confidential
information and is
>intended only for the individual named.If you are not the intended
>recipient you should not disseminate,distribute,store,print, copy or
>deliver this message.Please notify the sender immediately by e-mail
if
>you have received this e-mail by mistake and delete this e-mail from
>your system.
>
>
>
------------------------------------------------------------------------
>
> Hey,
> create or replace function sample(varchar,int) returns varchar as'
> declare
>         data alias for $1;
>         size alias for $2;
> begin
>         return  substr(data,(length(data)-size)+1,length(data));
> end;
> ' language 'plpgsql';
>
> ____________________________
> WARNING:  plpgsql: ERROR during compile of sample near line 2
> ERROR:  parse error at or near ";"
>
> Can any body tell me why is this error coming
>
>-----
>Warm Regards
>Sh=FFam Peri
>
>II Floor, Punja Building,
>M.G.Road,
>Ballalbagh,
>Mangalore-575003=20
>Ph : 91-824-2451001/5
>Fax : 91-824-2451050=20
>
>
>=20=20
>
>
>
> * DISCLAIMER: This message contains privileged and confidential=20
> information and is intended only for the individual named.If you are

> not the intended recipient you should not=20
> disseminate,distribute,store,print, copy or deliver this=20
> message.Please notify the sender immediately by e-mail if you have=20
> received this e-mail by mistake and delete this e-mail from your
system.*
>
>------------------------------------------------------------------------
>
>
>---------------------------(end of
broadcast)---------------------------
>TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org
>=20=20
>
Hi,

I juste did a copy/paste of your sample on my test DB. I didn't get
any=20
error message and the function works fine.

I run PostgreSQL 7.3.3



--=20
Jean-Michel Chabanne
77450 MONTRY (FRANCE)
48" 54' N - 2" 49' E
Powered by Linux


DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_274_664745.1064057031920-- From tgl@sss.pgh.pa.us Sat Sep 20 16:02:59 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 13147D1B4EE; Sat, 20 Sep 2003 16:02:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 77629-01; Sat, 20 Sep 2003 13:02:48 -0300 (ADT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by svr1.postgresql.org (Postfix) with ESMTP id B1181D1B56B; Sat, 20 Sep 2003 13:02:46 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.10/8.12.10) with ESMTP id h8KG2KiP024547; Sat, 20 Sep 2003 12:02:20 -0400 (EDT) To: shyamperi@davlin.co.in Cc: jeanmichel.chabanne@free.fr, pgsql-admin@postgresql.org, pgsql-sql@postgresql.org Subject: Re: Error with functions In-reply-to: <7144314.1064057032072.JavaMail.tomcat@mail.davlin.co.in> References: <7144314.1064057032072.JavaMail.tomcat@mail.davlin.co.in> Comments: In-reply-to shyamperi@davlin.co.in message dated "Sat, 20 Sep 2003 16:46:28 +0530" Date: Sat, 20 Sep 2003 12:02:20 -0400 Message-ID: <24543.1064073740@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/330 X-Sequence-Number: 10418 shyamperi@davlin.co.in writes: > CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' > BEGIN > RETURN $1 + 1; > END; > ' LANGUAGE 'plpgsql'; > The expected ouput of the above function should be 11 when we pass the 10 t= > o it.... but it returns 1. Works fine for me: regression=# CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' regression'# BEGIN regression'# RETURN $1 + 1; regression'# END; regression'# ' LANGUAGE 'plpgsql'; CREATE FUNCTION regression=# select add_one(10); add_one --------- 11 (1 row) Perhaps you should show us exactly what you did. regards, tom lane From shyamperi@davlin.co.in Mon Sep 22 04:47:52 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2E7BED1B8AE for ; Mon, 22 Sep 2003 04:47:52 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 29387-06 for ; Mon, 22 Sep 2003 01:47:41 -0300 (ADT) Received: from davlin.co.in (ns.vasnet.net.in [202.4.160.11]) by svr1.postgresql.org (Postfix) with ESMTP id 2B941D1B8AC for ; Mon, 22 Sep 2003 01:47:40 -0300 (ADT) Received: from Application (unknown [202.4.160.30]) by davlin.co.in (Postfix) with ESMTP id C9AE514B66 for ; Mon, 22 Sep 2003 09:52:27 +0530 (IST) Message-ID: <3381225.1064204992385.JavaMail.tomcat@mail.davlin.co.in> From: shyamperi@davlin.co.in To: pgsql-admin@postgresql.org Subject: error with functions Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_332_7752938.1064204992222" Date: Mon, 22 Sep 2003 09:52:27 +0530 (IST) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/335 X-Sequence-Number: 10423 ------=_Part_332_7752938.1064204992222 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 10:12a Dear all, This is about the same problem which I have been facing for the past one we= ek and which I am unable to solve.=20 I have create a function which return +1 of the argument passed. Function Definition: CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN $1 + 1; END; ' LANGUAGE 'plpgsql'; The output it was giving was always 1, despite any argument ( not string's = ofcourse) When I viewed the function definition in the pg_proc table...=20 psql "select proname,prosrc from pg_proc where proname=3D'add_one'" proname | prosrc ---------+------------------------------------------------------- add_one | BEGIN RETURN +1 END; (1 row) ______________ Can any body tell me why is the $1 missing..=20 I am using running postgres 7.3.4 in linux envt Have a grate day ----- Warm Regards Sh=FFam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003=20 Ph : 91-824-2451001/5 Fax : 91-824-2451050=20 ----------------Original Message------------------ Subject : Re: [ADMIN] Postgresql UPDATE LOCKS unrelated rows. Hi Stephan, Here is the table structure. FYI, we tried the experiment with mysql and the concurrency is working fine. create table TABLE1( TABLE_ID IDENTITY NOT NULL ,=20 VA_ID SMALLINT NOT NULL, V_STATES_ID SMALLINT NOT NULL,=20=20 V_VOL VARCHAR(6),=20 V_OBJ_ID INT,=20 V_CELL SMALLINT,=20 V_POOL VARCHAR(255),=20 FOREIGN KEY(VA_ID) REFERENCES TABLE2(VA_ID) ON DELETE CASCADE,=20 FOREIGN KEY(V_STATES_ID) REFERENCES V_STATES(V_STATES_ID),=20=20 PRIMARY KEY(TABLE_ID)); We were trying to update V_VOL using following statement: UPDATE TABLE1 SET V_VOL =3D 'ABCD' WHERE TABLE_ID =3D 100000 Regards, Ravi -----Original Message----- From: Stephan Szabo [mailto:sszabo@megazone.bigpanda.com]=20 Sent: Thursday, September 18, 2003 8:32 PM To: Ravi T Ramachandra Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] Postgresql UPDATE LOCKS unrelated rows. On Thu, 18 Sep 2003, Ravi T Ramachandra wrote: > > Hi, > > We are using postgresql 7.3.2 on lunux platform. We performed locking > test as follows via JDBC: > > Started 2 concurrent transaction with autocommit false and isolation > READ_COMMITTED : > > Transaction 1: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Update row 1 > Sleep for 30 seconds > commit: > > Transaction 2: > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Updated row 10000 > commit > > The second update had to wait for the first update operation to=20 > finish. We also made sure that the 2 unrelated rows are not on the=20 > same page. > > Is this expected behavior ? > Does update lock the whole table ? Generally not, but you really haven't given alot of information. What is the table layout for the table in question? Are there foreign keys involved? **************************Disclaimer************************************ Information contained in this E-MAIL being proprietary to Wipro Limited is=20 'privileged' and 'confidential' and intended for use only by the individual or entity to which it is addressed. You are notified that any use, copying=20 or dissemination of the information contained in the E-MAIL in any manner=20 whatsoever is strictly prohibited. *************************************************************************** ---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_332_7752938.1064204992222 Content-type: text/html Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=Untitled1

10:12a

Dear all,
This is about the same problem which I have been facing for= the past one week and which I am unable to solve.
I have create a func= tion which return +1 of the argument passed.

Function Definition:
CREATE FUNCTION add_one (integer) RETURNS INTEGE= R AS '
    BEGIN
      &= nbsp; RETURN $1 + 1;
    END;
' LANGUAGE 'plpgsql';
The output it was giving was always 1, despite any argument ( not stri= ng's ofcourse)
When I viewed the function definition in the pg_proc tabl= e...

psql "select proname,prosrc from pg_proc where proname=3D'add_one'"
&= nbsp;proname |          &= nbsp;           &nbs= p; prosrc
---------+----------------------------------------------------= ---
 add_one | BEGIN RETURN   +1 END;
(1 row)
_____= _________
Can any body tell me why is the $1 missing..
I am using ru= nning postgres 7.3.4 in linux envt

Have a grate day

-----
Warm Regards
Sh=FFam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003=20
Ph : 91-824-2451001/5
Fax : 91-824-2451050=20




----------------Original Message------------------
Su=
bject : Re: [ADMIN] Postgresql UPDATE LOCKS unrelated rows.


Hi Stephan,

Here is the table structure.  FYI, we tried the experiment with mysql
and the concurrency is working fine.

create table TABLE1( TABLE_ID IDENTITY NOT NULL ,=20
						VA_ID SMALLINT NOT NULL,

						V_STATES_ID SMALLINT NOT
NULL,=20=20
						V_VOL VARCHAR(6),=20
						V_OBJ_ID INT,=20
						V_CELL SMALLINT,=20
						V_POOL VARCHAR(255),=20
					FOREIGN KEY(VA_ID) REFERENCES
TABLE2(VA_ID) ON DELETE CASCADE,=20
					FOREIGN KEY(V_STATES_ID)
REFERENCES V_STATES(V_STATES_ID),=20=20
					PRIMARY KEY(TABLE_ID));
We were trying to update V_VOL using following statement:

UPDATE TABLE1 SET V_VOL =3D 'ABCD' WHERE TABLE_ID =3D 100000

Regards,
Ravi

-----Original Message-----
From: Stephan Szabo [mailto:sszabo@megazone.bigpanda.com]=20
Sent: Thursday, September 18, 2003 8:32 PM
To: Ravi T Ramachandra
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Postgresql UPDATE LOCKS unrelated rows.



On Thu, 18 Sep 2003, Ravi T Ramachandra wrote:

>
> Hi,
>
> We are using postgresql 7.3.2 on lunux platform.   We performed
locking
> test as follows via JDBC:
>
> Started 2 concurrent transaction with autocommit false and isolation

> READ_COMMITTED :
>
> Transaction 1:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Update row 1
> Sleep for 30 seconds
> commit:
>
> Transaction 2:
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> Updated row 10000
> commit
>
> The second update had to wait for the first update operation to=20
> finish. We also made sure that the 2 unrelated rows are not on the=20
> same page.
>
> Is this expected behavior ?
> Does update lock the whole table ?

Generally not, but you really haven't given alot of information.  What
is the table layout for the table in question?  Are there foreign keys
involved?


**************************Disclaimer************************************

Information contained in this E-MAIL being proprietary to Wipro
Limited is=20
'privileged' and 'confidential' and intended for use only by the
individual
 or entity to which it is addressed. You are notified that any use,
copying=20
or dissemination of the information contained in the E-MAIL in any
manner=20
whatsoever is strictly prohibited.

***************************************************************************

---------------------------(end of
broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if
your
      joining column's datatypes do not match


DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_332_7752938.1064204992222-- From shyamperi@davlin.co.in Mon Sep 22 05:14:11 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 62E33D1B563 for ; Mon, 22 Sep 2003 05:14:11 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 50892-01 for ; Mon, 22 Sep 2003 02:14:01 -0300 (ADT) Received: from davlin.co.in (ns.vasnet.net.in [202.4.160.11]) by svr1.postgresql.org (Postfix) with ESMTP id 1A74AD1B4FC for ; Mon, 22 Sep 2003 02:13:58 -0300 (ADT) Received: from Application (unknown [202.4.160.30]) by davlin.co.in (Postfix) with ESMTP id BCEDD14B70 for ; Mon, 22 Sep 2003 10:18:53 +0530 (IST) Message-ID: <3793959.1064206578358.JavaMail.tomcat@mail.davlin.co.in> From: shyamperi@davlin.co.in To: pgsql-admin@postgresql.org Subject: Re: error with functions Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_342_5145092.1064206577631" Date: Mon, 22 Sep 2003 10:18:53 +0530 (IST) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/337 X-Sequence-Number: 10425 ------=_Part_342_5145092.1064206577631 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Command: psql test -c "> CREATE FUNCTION add_one (integer) RETURNS INTEGER = AS ' BEGIN REURN $1 + 1; END; ' LANGUAGE 'plpgsql';" Result: CREATE FUNCTION And the function executed perfectly fine. ----- Warm Regards Sh=FFam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003=20 Ph : 91-824-2451001/5 Fax : 91-824-2451050=20 ----------------Original Message------------------ On Mon, 22 Sep 2003 shyamperi@davlin.co.in wrote: > Dear all, > This is about the same problem which I have been facing for the past one week and which I am unable to solve. > I have create a function which return +1 of the argument passed. > Function Definition: > CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' > BEGIN > RETURN $1 + 1; > END; > ' LANGUAGE 'plpgsql'; > > The output it was giving was always 1, despite any argument ( not string's ofcourse) > When I viewed the function definition in the pg_proc table... > > psql "select proname,prosrc from pg_proc where proname=3D'add_one'" > proname | prosrc > ---------+------------------------------------------------------- > add_one | BEGIN RETURN +1 END; > (1 row) > ______________ > Can any body tell me why is the $1 missing.. > I am using running postgres 7.3.4 in linux envt > Have a grate day How are you creating the function? DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_342_5145092.1064206577631 Content-type: text/html Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=Untitled1

Command: psql test -c "> CREATE FUNCTION add_one (integer) RETU= RNS INTEGER AS '     BEGIN     = ;    REURN $1 + 1;     END; ' LANGUAGE '= plpgsql';"

Result: CREATE FUNCTION

And the function executed perfectly fine.

-----
Warm Regards
Sh=FFam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003=20
Ph : 91-824-2451001/5
Fax : 91-824-2451050=20




----------------Original Message------------------
On Mon, 22 Sep 2003 shyamperi@davlin.co.in wrote:

> Dear all,
> This is about the same problem which I have been facing for the past
one week and which I am unable to solve.
> I have create a function which return +1 of the argument passed.
> Function Definition:
> CREATE FUNCTION add_one (integer) RETURNS INTEGER AS '
>     BEGIN
>         RETURN $1 + 1;
>     END;
> ' LANGUAGE 'plpgsql';
>
> The output it was giving was always 1, despite any argument ( not
string's ofcourse)
> When I viewed the function definition in the pg_proc table...
>
> psql "select proname,prosrc from pg_proc where proname=3D'add_one'"
>  proname |                        prosrc
> ---------+-------------------------------------------------------
>  add_one | BEGIN RETURN   +1 END;
> (1 row)
> ______________
> Can any body tell me why is the $1 missing..
> I am using running postgres 7.3.4 in linux envt
> Have a grate day

How are you creating the function?


DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_342_5145092.1064206577631-- From sszabo@megazone.bigpanda.com Mon Sep 22 05:02:38 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 2FA8CD1B575 for ; Mon, 22 Sep 2003 05:02:38 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 29073-10 for ; Mon, 22 Sep 2003 02:02:07 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 346E9D1B546 for ; Mon, 22 Sep 2003 02:02:06 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 04C9F352A7; Sun, 21 Sep 2003 22:01:51 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 03A6B35261; Sun, 21 Sep 2003 22:01:51 -0700 (PDT) Date: Sun, 21 Sep 2003 22:01:51 -0700 (PDT) From: Stephan Szabo To: shyamperi@davlin.co.in Cc: pgsql-admin@postgresql.org Subject: Re: error with functions In-Reply-To: <3381225.1064204992385.JavaMail.tomcat@mail.davlin.co.in> Message-ID: <20030921220113.B91581@megazone.bigpanda.com> References: <3381225.1064204992385.JavaMail.tomcat@mail.davlin.co.in> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/336 X-Sequence-Number: 10424 On Mon, 22 Sep 2003 shyamperi@davlin.co.in wrote: > Dear all, > This is about the same problem which I have been facing for the past one week and which I am unable to solve. > I have create a function which return +1 of the argument passed. > Function Definition: > CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' > BEGIN > RETURN $1 + 1; > END; > ' LANGUAGE 'plpgsql'; > > The output it was giving was always 1, despite any argument ( not string's ofcourse) > When I viewed the function definition in the pg_proc table... > > psql "select proname,prosrc from pg_proc where proname='add_one'" > proname | prosrc > ---------+------------------------------------------------------- > add_one | BEGIN RETURN +1 END; > (1 row) > ______________ > Can any body tell me why is the $1 missing.. > I am using running postgres 7.3.4 in linux envt > Have a grate day How are you creating the function? From shyamperi@davlin.co.in Mon Sep 22 06:07:17 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id A9F51D1B589 for ; Mon, 22 Sep 2003 06:07:17 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 55797-04 for ; Mon, 22 Sep 2003 03:07:07 -0300 (ADT) Received: from davlin.co.in (ns.vasnet.net.in [202.4.160.11]) by svr1.postgresql.org (Postfix) with ESMTP id 17DDBD1B8A3 for ; Mon, 22 Sep 2003 03:07:06 -0300 (ADT) Received: from Application (unknown [202.4.160.30]) by davlin.co.in (Postfix) with ESMTP id 4A8AA14B66 for ; Mon, 22 Sep 2003 11:12:02 +0530 (IST) Message-ID: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in> From: shyamperi@davlin.co.in To: pgsql-admin@postgresql.org Subject: Re: error with functions Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_351_7263730.1064209766410" Date: Mon, 22 Sep 2003 11:12:02 +0530 (IST) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/339 X-Sequence-Number: 10427 ------=_Part_351_7263730.1064209766410 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable >You do realize that the shell is going to interpret that string in >double quotes right? I guess so, for the very same I have tried with Command: psql test -c "> CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN ''$1'' + 1; END; ' LANGUAGE 'plpgsql';" But still it is not taking it as $1, instead empty string. Ideeally it shud consider $1 as string... but why isn't it ----- Warm Regards Sh=FFam Peri II Floor, Punja Building, M.G.Road, Ballalbagh, Mangalore-575003=20 Ph : 91-824-2451001/5 Fax : 91-824-2451050=20 ----------------Original Message------------------ On Mon, 22 Sep 2003 shyamperi@davlin.co.in wrote: > Command: psql test -c "> CREATE FUNCTION add_one (integer) RETURNS > INTEGER AS ' BEGIN REURN $1 + 1; END; ' LANGUAGE > 'plpgsql';" You do realize that the shell is going to interpret that string in double quotes right? ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_351_7263730.1064209766410 Content-type: text/html Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=Untitled1

>You do realize that the shell is going to interpret that strin= g in
>double quotes right?
I guess so, for the very same I have tr= ied with
Command: psql test -c "> CREATE FUNCTION add_one (integer) R= ETURNS
 INTEGER AS '     BEGIN   = ;      RETURN ''$1'' + 1;     = END; ' LANGUAGE
 'plpgsql';"
But still it is not taking it as $1= , instead empty string.
Ideeally it shud consider $1 as string... but wh= y isn't it

-----
Warm Regards
Sh=FFam Peri

II Floor, Punja Building,
M.G.Road,
Ballalbagh,
Mangalore-575003=20
Ph : 91-824-2451001/5
Fax : 91-824-2451050=20




----------------Original Message------------------
On Mon, 22 Sep 2003 shyamperi@davlin.co.in wrote:

> Command: psql test -c "> CREATE FUNCTION add_one (integer) RETURNS
> INTEGER AS '     BEGIN         REURN $1 + 1;     END; ' LANGUAGE
> 'plpgsql';"

You do realize that the shell is going to interpret that string in
double quotes right?


---------------------------(end of
broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to
majordomo@postgresql.org


DISCLAIMER: This message contains privileged and confidential information a= nd is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. ------=_Part_351_7263730.1064209766410-- From sszabo@megazone.bigpanda.com Mon Sep 22 05:54:40 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 5B6C2D1B906 for ; Mon, 22 Sep 2003 05:54:40 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 50922-10 for ; Mon, 22 Sep 2003 02:54:30 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id B047AD1B546 for ; Mon, 22 Sep 2003 02:54:29 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 3CB2035126; Sun, 21 Sep 2003 22:54:30 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 3B9CB35120; Sun, 21 Sep 2003 22:54:30 -0700 (PDT) Date: Sun, 21 Sep 2003 22:54:30 -0700 (PDT) From: Stephan Szabo To: shyamperi@davlin.co.in Cc: pgsql-admin@postgresql.org Subject: Re: error with functions In-Reply-To: <3793959.1064206578358.JavaMail.tomcat@mail.davlin.co.in> Message-ID: <20030921225326.B92348@megazone.bigpanda.com> References: <3793959.1064206578358.JavaMail.tomcat@mail.davlin.co.in> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/338 X-Sequence-Number: 10426 On Mon, 22 Sep 2003 shyamperi@davlin.co.in wrote: > Command: psql test -c "> CREATE FUNCTION add_one (integer) RETURNS > INTEGER AS ' BEGIN REURN $1 + 1; END; ' LANGUAGE > 'plpgsql';" You do realize that the shell is going to interpret that string in double quotes right? From olly@lfix.co.uk Mon Sep 22 15:43:20 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id AACAAD1B4EA for ; Mon, 22 Sep 2003 15:43:20 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 51397-01 for ; Mon, 22 Sep 2003 12:42:48 -0300 (ADT) Received: from anchor-post-31.mail.demon.net (anchor-post-31.mail.demon.net [194.217.242.89]) by svr1.postgresql.org (Postfix) with ESMTP id E6788D1C9E7 for ; Mon, 22 Sep 2003 12:42:47 -0300 (ADT) Received: from lfix.demon.co.uk ([80.177.205.209] helo=cerberus.lfix.co.uk) by anchor-post-31.mail.demon.net with esmtp (Exim 3.35 #1) id 1A1Spq-0005iI-0V; Mon, 22 Sep 2003 16:42:46 +0100 Received: from linda.lfix.co.uk ([192.168.1.1]) by cerberus.lfix.co.uk with esmtp (Exim 4.22) id 1A1SpZ-0001HI-HR; Mon, 22 Sep 2003 16:42:29 +0100 Subject: Re: error with functions From: Oliver Elphick To: shyamperi@davlin.co.in Cc: pgsql-admin@postgresql.org In-Reply-To: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in> References: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in> Content-Type: text/plain Organization: LFIX Limited Message-Id: <1064245382.26041.252.camel@linda.lfix.co.uk> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.4 Date: Mon, 22 Sep 2003 16:43:02 +0100 Content-Transfer-Encoding: 7bit X-LFIX-MailScanner: Found to be clean X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/344 X-Sequence-Number: 10432 On Mon, 2003-09-22 at 06:42, shyamperi@davlin.co.in wrote: > >You do realize that the shell is going to interpret that string in > >double quotes right? > I guess so, for the very same I have tried with > Command: psql test -c "> CREATE FUNCTION add_one (integer) RETURNS > INTEGER AS ' BEGIN RETURN ''$1'' + 1; END; ' LANGUAGE > 'plpgsql';" > But still it is not taking it as $1, instead empty string. > Ideeally it shud consider $1 as string... but why isn't it It's still being interpreted by the shell. The shell takes no notice at all of the nested quotes; everything inside the double quotes is treated as literal text, after replacing variables. Look here: olly@linda$ echo psql test -c "> CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN ''$1'' + 1; END; ' LANGUAGE 'plpgsql';" psql test -c > CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN '''' + 1; END; ' LANGUAGE 'plpgsql'; Instead of trying to quote $1, you need to escape the dollar sign: olly@linda$ echo psql test -c "> CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN \$1 + 1; END; ' LANGUAGE 'plpgsql';" psql test -c > CREATE FUNCTION add_one (integer) RETURNS INTEGER AS ' BEGIN RETURN $1 + 1; END; ' LANGUAGE 'plpgsql'; -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Therefore when thou doest thine alms, do not sound a trumpet before thee, as the hypocrites do in the synagogues and in the streets, that they may have glory of men. Verily I say unto you, They have their reward. But when thou doest alms, let not thy left hand know what thy right hand doeth; That thine alms may be in secret; and thy Father which seeth in secret himself shall reward thee openly." Matthew 6:2-4 From sszabo@megazone.bigpanda.com Mon Sep 22 15:43:54 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id DC254D1C9F0 for ; Mon, 22 Sep 2003 15:43:54 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 49082-07 for ; Mon, 22 Sep 2003 12:43:44 -0300 (ADT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id 33874D1B57E for ; Mon, 22 Sep 2003 12:43:44 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 66A033522D; Mon, 22 Sep 2003 08:43:38 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 6539A35197; Mon, 22 Sep 2003 08:43:38 -0700 (PDT) Date: Mon, 22 Sep 2003 08:43:38 -0700 (PDT) From: Stephan Szabo To: shyamperi@davlin.co.in Cc: pgsql-admin@postgresql.org Subject: Re: error with functions In-Reply-To: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in> Message-ID: <20030922083927.M2590@megazone.bigpanda.com> References: <2110482.1064209766872.JavaMail.tomcat@mail.davlin.co.in> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/345 X-Sequence-Number: 10433 On Mon, 22 Sep 2003 shyamperi@davlin.co.in wrote: > >You do realize that the shell is going to interpret that string in > >double quotes right? > I guess so, for the very same I have tried with > Command: psql test -c "> CREATE FUNCTION add_one (integer) RETURNS > INTEGER AS ' BEGIN RETURN ''$1'' + 1; END; ' LANGUAGE > 'plpgsql';" > But still it is not taking it as $1, instead empty string. > Ideeally it shud consider $1 as string... but why isn't it The shell interprets the double quoted string and effectively replaces $1 with the shell's idea of what to put in place of it. This really has nothing to do with postgres at all. Use a backslash before the $1, or put it in a file and execute it from there. Try these for example: echo "$1" echo '$1' echo "\$1"