아마도 site_id 가 primary key 로 설정되어 있는 것 같군요. 그리고 site_id 에 혹시 이미 기존의 값을 가진 row 가 존재하는 것 아닌가요. 그런 생각이 드는군요.
select * from crawlsite;
하셔서 존재하는 row 가 없는지 확인해 보시기 바랍니다.
자동으로 seqeuence 를 증가시키고자 한다면 다음과 같이 그 필드의 값을 무시하고 insert 하시면 됩니다.
insert into crawlsite(site_kind, site_cate,....) values (...);
(여기서 site_id 라는 필드값이 빠져 있음을 주의하시기 바랍니다.) 이렇게 할 경우 site_id 에는 default 구문에서 정의된 default 값이 삽입됩니다.
>>강민철 님께서 쓰시길<<
:: Table "crawlsite"
:: Attribute | Type | Modifier
:: ----------------+-----------------------+-------------------------------------------
:: site_id | numeric(5,0) | not null default nextval('SITESEQ'::text)
:: site_kind | numeric(5,0) | not null
:: site_cate | numeric(5,0) | not null
:: site_abbr | character varying(30) | not null
:: site_url | character varying(60) | not null
:: site_name | character varying(60) | not null
:: site_crawlday | numeric(2,0) | not null
:: site_starthour | numeric(2,0) | not null
:: site_endhour | numeric(2,0) | not null
:: site_interval | numeric(3,0) | not null
:: site_language | numeric(5,0) | not null
:: site_quit | numeric(2,0) | not null
:: site_charset | numeric(5,0) | not null
:: Index: crawlsite_pkey
::
:: 테이블이 이런식으로 있을때
:: insert into crawlsite values(NEXTVAL('siteseq'), 1, 0, 'securityfocus', 'securityfocus.com', 'se
:: curityfocus',9,5,23,60,1001,1,3001);
::
:: 이렇게 해주면
:: ERROR: Cannot insert a duplicate key into unique index crawlsite_pkey
:: 이런 에러가 나는군요 site_id 를 자동 증가 시키고 싶은에 방법이 없을까요?
:: 답변 부탁드립니다
|