Re: duplicate key ? (fwd) - Mailing list pgsql-general

From KuroiNeko
Subject Re: duplicate key ? (fwd)
Date
Msg-id 39F11FBC.nailDN114K4D@ed.ed
Whole thread Raw
In response to duplicate key ? (fwd)  (Sungchul Park <scpark@gen128.com>)
Responses Re: duplicate key ? (fwd)  (Sungchul Park <scpark@gen128.com>)
List pgsql-general
> Fo2Me=# drop table dirinfo;
> DROP
> Fo2Me=# CREATE TABLE dirinfo(
> Fo2Me(# code VARCHAR(8) PRIMARY KEY,
> Fo2Me(# level SMALLINT NOT NULL,
> Fo2Me(# name TEXT NOT NULL,
> Fo2Me(# count SMALLINT NOT NULL DEFAULT 0
> Fo2Me(# );
> NOTICE:   CREATE   TABLE/PRIMARY   KEY   will   create   implicit   index
> 'dirinfo_pkey'
> for table 'dirinfo'
> CREATE
> Fo2Me=#  INSERT  INTO  dirinfo  (code, level,  name)  VALUES('hbcol',  1,
> 'abc');
> INSERT 63411 1
> Fo2Me=#  INSERT  INTO  dirinfo  (code, level,  name)  VALUES('hbcrf',  1,
> 'zzz');
> ERROR: Cannot insert a duplicate key into unique index dirinfo_pkey
>
> The version of  postgresql is 7.0.2 and the database  created with EUC_KR
>encoding.

 And  that's strange.  I'm not  sure about  encodings, never  used them....
Probably you should  use another datatype to textual  attributes? It's very
likely that  when you're  trying to  enter 'hbcol',  an escape  sequence is
entered  (2  bytes), and  then  each  ASCII  char  also takes  two  octets.
Hmmmm.... So, it's truncated? If so, then with the first insert only escape
sequence and 'hbc'  is inserted and this causes duplication  for the second
insert?
 Just  a wild  speculation.  Someone  with more  experience  would be  more
helpfull.


--

 contaminated fish and microchips
  huge supertankers on Arabian trips
 oily propaganda from the leaders' lips
  all about the future
 there's people over here, people over there
  everybody's looking for a little more air
 crossing all the borders just to take their share
  planning for the future

 Rainbow, Difficult to Cure

pgsql-general by date:

Previous
From: Ashley Clark
Date:
Subject: trigger/cached updates question
Next
From: Sungchul Park
Date:
Subject: Re: duplicate key ? (fwd)