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--