Re: [SQL] Check before INSERT INTO

2008-02-12 Thread Richard Huxton
Shavonne Marietta Wijesinghe wrote: Even though n_gen is defined as a serial I can't let it handle the progressive key by its self since there is the need that some records should have the same value. Of course you can - the default is only provided if you don't provide your own. That's

Re: [SQL] Check before INSERT INTO

2008-02-12 Thread Shavonne Marietta Wijesinghe
t;; Sent: Tuesday, February 12, 2008 11:35 AM Subject: Re: [SQL] Check before INSERT INTO Shavonne Marietta Wijesinghe wrote: Thanks for the replies.. But my problem still continues even after setting the isolation level. Set oRs = oConn.Execute("SELECT N_GEN FROM MY_TABLE ORDER BY N_GEN::I

Re: [SQL] Check before INSERT INTO

2008-02-12 Thread Richard Huxton
Shavonne Marietta Wijesinghe wrote: Thanks for the replies.. But my problem still continues even after setting the isolation level. Set oRs = oConn.Execute("SELECT N_GEN FROM MY_TABLE ORDER BY N_GEN::INT DESC") If err <> 0 then 'If table not found GetFieldValue = "1" WriteToFile logfilepath,

Re: [SQL] Check before INSERT INTO

2008-02-12 Thread Shavonne Marietta Wijesinghe
;. Sadly both the current users get the value "6". Have i set the isolation level correctly?? Thanks Shavonne - Original Message - From: "Jean-David Beyer" <[EMAIL PROTECTED]> To: Sent: Monday, February 11, 2008 5:55 PM Subject: Re: [SQL] Check before IN

Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Jean-David Beyer
Shavonne Marietta Wijesinghe wrote: > Thanks for the reply Grogory. I am trying to do a INSERT INTO. > > Here is my table. n_gen, n_sheet, tot_n_sheet are defined as Primary Key > (Serial not null) That is sure confusing. What could a DDL saying INTEGER n_gen SERIAL NOT NULL; INTEGER n_she

Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Gregory Stark
"Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]> writes: > Thanks for the reply Grogory. I am trying to do a INSERT INTO. > > Here is my table. n_gen, n_sheet, tot_n_sheet are defined as Primary Key > (Serial not null) > id | n_gen | n_sheet | tot_n_sheet > --+---+---

Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Shavonne Marietta Wijesinghe
Thanks for the reply Grogory. I am trying to do a INSERT INTO. Here is my table. n_gen, n_sheet, tot_n_sheet are defined as Primary Key (Serial not null) id | n_gen | n_sheet | tot_n_sheet --+---+---+- a| 1| 1 | 1

Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Gregory Stark
"Shavonne Marietta Wijesinghe" <[EMAIL PROTECTED]> writes: > The user updates the DB via ASP. When 2 users click on the submit button at > the > same time, only 1 record is inserted. (ERROR: duplicate key violates unique > constraint "my_shevi_pkey") > > For example they both send a string like b

Re: [SQL] Check before INSERT INTO

2008-02-11 Thread Shavonne Marietta Wijesinghe
- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Shavonne Marietta Wijesinghe Sent: Monday, February 11, 2008 1:04 PM To: pgsql-sql@postgresql.org Subject: [SQL] Check before INSERT INTO My table structure CREATE TABLE my_shevi

[SQL] Check before INSERT INTO

2008-02-11 Thread Shavonne Marietta Wijesinghe
My table structure CREATE TABLE my_shevi ( id text, n_gen serial NOT NULL, n_sheet serial NOT NULL, tot_sheet serial NOT NULL, CONSTRAINT my_shevi_pkey PRIMARY KEY (n_gen, n_sheet, tot_sheet) ) WITH OIDS; ALTER TABLE my_shevi OWNER TO postgres; The user updates the DB via ASP. When 2 u