Re: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-27 Thread Hiroshi Inoue
Tom Lane wrote: > > Philip Warner <[EMAIL PROTECTED]> writes: > >> The workaround for Forest is to make the final SELECT be a SELECT FOR > >> UPDATE, so that it's playing by the same rules as the earlier commands. > > > Eek. Does this seem good to you? > > I did call it a workaround ;-) > > I d

Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-27 Thread Forest Wilkinson
On Tuesday 27 March 2001 15:14, Tom Lane wrote: > Forest Wilkinson <[EMAIL PROTECTED]> writes: > > session1<< create function nextid( varchar(32)) returns int8 as ' > > session1<< select * from idseq where name = $1::text for update; > > session1<< update idseq set id = id + 1 where name = $1:

[HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-27 Thread Tom Lane
Forest Wilkinson <[EMAIL PROTECTED]> writes: > If I remember correctly, UPDATE establishes a lock on the affected rows, > which will block another UPDATE on the same rows for the duration of the > transaction. If that's true, shouldn't I be able to achieve my desired > behavior by removing the

Re: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-27 Thread Tom Lane
Philip Warner <[EMAIL PROTECTED]> writes: >> The workaround for Forest is to make the final SELECT be a SELECT FOR >> UPDATE, so that it's playing by the same rules as the earlier commands. > Eek. Does this seem good to you? I did call it a workaround ;-) I don't think that we dare try to make

Re: [HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-27 Thread Philip Warner
At 18:14 27/03/01 -0500, Tom Lane wrote: >Forest Wilkinson <[EMAIL PROTECTED]> writes: >> session1<< create function nextid( varchar(32)) returns int8 as ' >> session1<< select * from idseq where name = $1::text for update; >> session1<< update idseq set id = id + 1 where name = $1::text; >> s

Re: [SQL] Re: psql win32 version

2001-03-27 Thread Josh Berkus
Chris, Jack, Etc: > > Thank you for your help, but the URL > > http://www.zeos.dn.ua/download/ipgsql-1.6.2.zip is a broken link. > Would > > you please check again. Thank you very much. > > The problem is that your ISP has a vicious anti spam policy in place. > They block all contact with certai

Re: [SQL] Re: psql win32 version

2001-03-27 Thread Christopher Sawtell
On Thu, 22 Mar 2001 11:45, Jack wrote: > Hi, Christopher > > Thank you for your help, but the URL > http://www.zeos.dn.ua/download/ipgsql-1.6.2.zip is a broken link. Would > you please check again. Thank you very much. One of these may work for you. http://www.google.com/search?q=ipgsql-1.6.2.zi

Re: [SQL] Re: psql win32 version

2001-03-27 Thread Christopher Sawtell
On Thu, 22 Mar 2001 11:45, Jack wrote: > Hi, Christopher > > Thank you for your help, but the URL > http://www.zeos.dn.ua/download/ipgsql-1.6.2.zip is a broken link. Would > you please check again. Thank you very much. The problem is that your ISP has a vicious anti spam policy in place. They bl

[HACKERS] Re: [SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-27 Thread Tom Lane
Forest Wilkinson <[EMAIL PROTECTED]> writes: > session1<< create function nextid( varchar(32)) returns int8 as ' > session1<< select * from idseq where name = $1::text for update; > session1<< update idseq set id = id + 1 where name = $1::text; > session1<< select id from idseq where name =

Re: [SQL] RE: pl/pgsql and returning rows

2001-03-27 Thread Bruce Momjian
FYI, I am always looking for additional examples that I should add in the next edition. > Yes: good example! I keep a printed copy on my desk... :-) > > > -Original Message- > > From: Bruce Momjian [SMTP:[EMAIL PROTECTED]] > > Sent: Tuesday, March 27, 2001 3:52 PM > > To:

Re: [SQL] RE: pl/pgsql and returning rows

2001-03-27 Thread Bruce Momjian
MY book in chapter 18 has a Pl/PgSQL function called change_statename that does insert/update automatically. http://www.postgresql.org/docs/awbook.html > As a workaround, you can insert your row into an existing table, then > retrieve it from there later. I think you need to enumerate a

[SQL] RE: pl/pgsql and returning rows

2001-03-27 Thread Jeff Eckermann
As a workaround, you can insert your row into an existing table, then retrieve it from there later. I think you need to enumerate all of the fields, as in 'INSERT INTO table VALUES (ret.field1, ret.field2,...ret.fieldn);'. At least, I haven't succeeded any other way. Messy, but the best method a

[SQL] possible row locking bug in 7.0.3 & 7.1

2001-03-27 Thread Forest Wilkinson
I'm having a problem with functions written in SQL. Specifically, they don't seem to be adhering to Postgres locking rules. For the record, I'm using postgres 7.0.3, installed from RPMs, on Red Hat 6.2. I got the same results with postgres 7.1 beta 6, installed from sources. Here's what I'm s

Re: [SQL] Replace into...?

2001-03-27 Thread Tom Lane
"Diehl, Jeffrey" <[EMAIL PROTECTED]> writes: > I'm in the process of migrating a database and application suite from mysql > to postgresql. The problem is that I've used > mysql's "replace into..." quite frequently... > Does anyone know of a "clean" way to implement this feature in postgresql? >

Re: [SQL] Replace into...?

2001-03-27 Thread Peter Eisentraut
Diehl, Jeffrey writes: > I'm in the process of migrating a database and application suite from mysql > to postgresql. The problem is that I've used > mysql's "replace into..." quite frequently... begin transaction; update ... insert ... commit; or some permutation thereof. If you need to

RE: [SQL] AY

2001-03-27 Thread Gerald Gutierrez
What does "=P0] Ick ,O$0;r7N+d, ,O$0;r&r*:AYmailto:[EMAIL PROTECTED]]On Behalf Of S.F. Lee Sent: Monday, March 26, 2001 5:40 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [SQL] AY wrote: > > I'm using 7.1 Beta 3, which has been pretty > stable up until now. This > > morning, I went

Re: [SQL] Re: Still don't know how to build this string ? how to concat ??

2001-03-27 Thread [EMAIL PROTECTED]
If I understand corrently, the idea is to get a comma delimited list as a result. here is a modified function with a slightly different set of names for the table. The commands include commands to add and drop the needed tables. CREATE TABLE emps (username text, userid int4); INSERT INTO emps

Re: [SQL] Re: Still don't know how to build this string ? how to concat ??

2001-03-27 Thread Andy Corteen
Hello Andy, Tuesday, March 27, 2001, 3:22:37 PM, you wrote: AC> Tuesday, March 27, 2001, 10:20:18 AM, you wrote: jrpc>> jrpc>> Result: jrpc>> 01 1440 jrpc>> 02 1460 jrpc>> 03 1398 jrpc>> The values (1440, ...) are the last entries of z_u_umfang for each z_u_typ. jrpc>> This is correct

Re: [SQL] Upgrading from 6.2 to 7

2001-03-27 Thread Tom Lane
"Sean Weissensee" <[EMAIL PROTECTED]> writes: > We are planing to upgrade to version 7 of Postgres, > I understand that you cannot use version 6 databases with 7. > Where can I find information on how to convert these Databases ? Short version: pg_dumpall (with old version), initdb, reload. Lon

Re: [SQL] Re: Still don't know how to build this string ? how to concat ??

2001-03-27 Thread Andy Corteen
Tuesday, March 27, 2001, 10:20:18 AM, you wrote: jrpc> jrpc> Result: jrpc> 01 1440 jrpc> 02 1460 jrpc> 03 1398 jrpc> The values (1440, ...) are the last entries of z_u_umfang for each z_u_typ. jrpc> This is correct since in the function the list:= ... is overwritten until jrpc> the last

[SQL] Upgrading from 6.2 to 7

2001-03-27 Thread Sean Weissensee
We are planing to upgrade to version 7 of Postgres, I understand that you cannot use version 6 databases with 7.  Where can I find information on how to convert these Databases ?   Sean   Ion Solutions

Re: [SQL] Functions and Triggers

2001-03-27 Thread Jan Wieck
Cedar Cox wrote: > > CREATE FUNCTION lastupdated() RETURNS opaque AS ' > begin > new.last_updated := CURRENT_TIMESTAMP; > return new; > end; > ' LANGUAGE 'plpgsql'; > > CREATE TRIGGER trigname BEFORE INSERT OR UPDATE on tblname > FOR EACH ROW EXECUTE PROCEDURE lastupdated(); > > Note: you co

Re: [SQL] all views in database broken at once

2001-03-27 Thread Jan Wieck
Mathijs Brands wrote: > On Sat, Mar 24, 2001 at 11:36:56PM -0500, Tom Lane allegedly wrote: > > Mathijs Brands <[EMAIL PROTECTED]> writes: > > > How about being able to recompile them (keeping the SQL around in the > > > system catalogs)? Doesn't Oracle allow you to do something like that? > > > >

[SQL] Re: Still don't know how to build this string ?

2001-03-27 Thread juerg . rietmann
Hey folk's Thanks everybody helping me with my problem, it is solved ! The problem was that I took double quotes instead of single quotes ... arg. By the way, is there any doc's about plpgsql ? jr PFISTER + PARTNER, SYSTEM - ENGINEERING AG Juerg

[SQL] Re: Still don't know how to build this string ? how to concat ??

2001-03-27 Thread juerg . rietmann
Hello I'm closer to a solution. The query results is : Result: 01 1440 02 1460 03 1398 The values (1440, ...) are the last entries of z_u_umfang for each z_u_typ. This is correct since in the function the list:= ... is overwritten until the last record is read. When I try to concat the l

Re: [SQL] pl/pgsql and returning rows

2001-03-27 Thread Richard Huxton
From: "wade" <[EMAIL PROTECTED]> > create function get_details(int4) returns details as ' > declare > ret details%ROWTYPE; > site_recrecord; > cntct contacts%ROWTYPE; > begin > select into site_rec * sites_table where id = $1 limit 1; > select into cntct * from contacts where