[GENERAL] unique key issue

2006-09-19 Thread Junkone
HI
I have a table with a unique key constraint on col1,col2. The dattabase
allowed an multiple inserts. here is how

col1  col2
'abc'  empty space
'abc'  empty space

I am not sure how this can happen


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


Re: [GENERAL] remote duplicate rows

2006-09-16 Thread Junkone
Thanks for all of your help. I backed up the table and used the PgAdmin
tool to create Insert statements. It did it in two sets. I reran the
first set and it solved the problem.

Seede

Andrews, Chris wrote:
 Dunno about quickly, but I usually do something like this (before slapping 
 myself in the face for getting into that state):

 CREATE TABLE tn_backup AS SELECT DISTINCT * FROM tn;
 TRUNCATE TABLE tn;
 INSERT INTO tn VALUES SELECT * from tn_backup;

 (Where tn is the table name)

 May not be the best way, but keeps indexes and stuff on the original table if 
 you don't want to set them all up again. Me lazy?

 That said, if you've got foriegn keys pointing at it, the truncate ain't 
 going to work.

 Or if you have your data exported as a tab or csv, the use sort | uniq on it 
 and
 shove it back in...



 -Original Message-
 From: Junkone [mailto:[EMAIL PROTECTED]
 Sent: 13 September 2006 23:47
 To: pgsql-general@postgresql.org
 Subject: [GENERAL] remote duplicate rows


 hI
 i have a bad situation that i did not have primary key. so i have a
 table like this
 colname1colname2
 1 apple
 1 apple
 2  orange
 2   orange

 It is a very large table. how do i remove the duplctes quickly annd
 without much change.

 Regards

 Seede


 -
 The information contained in this email is confidential and is
 intended for the recipient only. If you have received it in error,
 please notify us immediately by reply email and then delete it from
 your system. Please do not copy it or use it for any purposes, or
 disclose its contents to any other person or store or copy this
 information in any medium. The views contained in this email are
 those of the author and not necessarily those of Lorien plc.




 Thank you for your co-operation.


 ---(end of broadcast)---
 TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[GENERAL] remote duplicate rows

2006-09-13 Thread Junkone
hI
i have a bad situation that i did not have primary key. so i have a
table like this
colname1colname2
1 apple
1 apple
2  orange
2   orange

It is a very large table. how do i remove the duplctes quickly annd
without much change.

Regards

Seede


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[GENERAL] ruby driver postgresql

2006-08-25 Thread Junkone
HI
I am using the C driver and am trying to run this statement
irb(main):020:0 a=conn.exec(select * from exchanges where id=$1,4)
ArgumentError: wrong number of arguments (2 for 1)
from (irb):20:in `exec'
from (irb):20
from :0
irb(main):021:0

I get the error. But the ruby doc stats that i can use this parameteric
query. any pointers will be useful.
Regarfds

Seede


---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


[GENERAL] How to do auto numbering on INT column

2006-08-10 Thread Junkone
HI
I have a simple table created using PGAdmin III. How do i do a auto
numbering on a column SYMBOL_ID?
My table is
CREATE TABLE SYMBOL
(
  SYMBOL_ID int4 NOT NULL,
  SYMBOL2EXCHANGE int2 NOT NULL,
  SYMBOL_ALIAS text[],
  RELATED_SYMBOLS_OTHER_EXCHANGES int8[],
  SYMBOL_NAME text,
  COMPANY_NAME text,
  SYMBOL2SECTOR int2,
  SYMBOL2INDUSTRY int4,
  STOCK_SUMMARY text
) 

Thanks

Seede


---(end of broadcast)---
TIP 6: explain analyze is your friend