Обсуждение: Need to Remove Constraint, but Don't Know How - Previous attempts failed

Поиск
Список
Период
Сортировка

Need to Remove Constraint, but Don't Know How - Previous attempts failed

От
"Wang, Mary Y"
Дата:
Hi,

I'm sorry but I didn't create the table.  I fiddled with the table for a while and didn't get what I expected.  So I'm
goingto ask the community. 

Can some one tell me which constraint would case me the "duplicate key into unique index users_pkey"?  I'd like to
removethat constraint. 

Here is the create:
CREATE TABLE "users" (
        "user_id" integer DEFAULT nextval('users_pk_seq'::text) NOT NULL,
        "user_name" text DEFAULT '' NOT NULL,
        "email" text DEFAULT '' NOT NULL,
        "user_pw" character varying(32) DEFAULT '' NOT NULL,
        "realname" character varying(32) DEFAULT '' NOT NULL,
        "status" character(1) DEFAULT 'A' NOT NULL,
        "shell" character varying(20) DEFAULT '/bin/bash' NOT NULL,
        "unix_pw" character varying(40) DEFAULT '' NOT NULL,
        "unix_status" character(1) DEFAULT 'N' NOT NULL,
        "unix_uid" integer DEFAULT '0' NOT NULL,
        "unix_box" character varying(10) DEFAULT 'shell1' NOT NULL,
        "add_date" integer DEFAULT '0' NOT NULL,
        "confirm_hash" character varying(32),
        "mail_siteupdates" integer DEFAULT '0' NOT NULL,
        "mail_va" integer DEFAULT '0' NOT NULL,
        "authorized_keys" text,
        "email_new" text,
        "people_view_skills" integer DEFAULT '0' NOT NULL,
        "people_resume" text DEFAULT '' NOT NULL,
        "timezone" character varying(64) DEFAULT 'GMT',
        "language" integer DEFAULT '1' NOT NULL,
        "third_party" integer DEFAULT 1 NOT NULL,
        "personal_status" character(32),
        "bemsid" integer,
        "sensitive_info" character(64),
        "reason_access" text,
        "organization" text,
        Constraint "users_pkey" Primary Key ("user_id")
);

Here is my table:

                                         Table "users"
      Attribute       |         Type          |                    Modifier

----------------------+-----------------------+---------------------------------
---------------
 user_id              | integer               | not null default nextval('users_
pk_seq'::text)
 user_name            | text                  | not null default ''
 email                | text                  | not null default ''
 user_pw              | character varying(32) | not null default ''
 realname             | character varying(32) | not null default ''
 status               | character(1)          | not null default 'A'
 shell                | character varying(20) | not null default '/bin/bash'
 unix_pw              | character varying(40) | not null default ''
 unix_status          | character(1)          | not null default 'N'
 unix_uid             | integer               | not null default '0'
 unix_box             | character varying(10) | not null default 'shell1'
 add_date             | integer               | not null default '0'
 confirm_hash         | character varying(32) |
 mail_siteupdates     | integer               | not null default '0'
 mail_va              | integer               | not null default '0'
 authorized_keys      | text                  |
 email_new            | text                  |
 people_view_skills   | integer               | not null default '0'
 people_resume        | text                  | not null default ''
 timezone             | character varying(64) | default 'GMT'
 language             | integer               | not null default '1'
 third_party          | integer               | not null default 1
 personal_status      | character(32)         |
 bemsid               | integer               |
 sensitive_info       | character(64)         |
 reason_access        | text                  |
 organization         | text                  |
 brass_first_time     | character(1)          | default '0'
 mail_sitenews_update | integer               | default '0'
 doclinks_sort_order  | character(1)          | default 'A'
Indices: idx_users_username,
         user_user,
         users_pkey,
         users_user_pw


------------------------------------------------
Mary Y Wang




Re: Need to Remove Constraint, but Don't Know How - Previous attempts failed

От
Adrian Klaver
Дата:
On Wednesday 03 February 2010 4:57:09 pm Wang, Mary Y wrote:
> Hi,
>
> I'm sorry but I didn't create the table.  I fiddled with the table for a
> while and didn't get what I expected.  So I'm going to ask the community.
>
> Can some one tell me which constraint would case me the "duplicate key into
> unique index users_pkey"?  I'd like to remove that constraint.
>
> Here is the create:
> CREATE TABLE "users" (
>         "user_id" integer DEFAULT nextval('users_pk_seq'::text) NOT NULL,
>         "user_name" text DEFAULT '' NOT NULL,
>         "email" text DEFAULT '' NOT NULL,
>         "user_pw" character varying(32) DEFAULT '' NOT NULL,
>         "realname" character varying(32) DEFAULT '' NOT NULL,
>         "status" character(1) DEFAULT 'A' NOT NULL,
>         "shell" character varying(20) DEFAULT '/bin/bash' NOT NULL,
>         "unix_pw" character varying(40) DEFAULT '' NOT NULL,
>         "unix_status" character(1) DEFAULT 'N' NOT NULL,
>         "unix_uid" integer DEFAULT '0' NOT NULL,
>         "unix_box" character varying(10) DEFAULT 'shell1' NOT NULL,
>         "add_date" integer DEFAULT '0' NOT NULL,
>         "confirm_hash" character varying(32),
>         "mail_siteupdates" integer DEFAULT '0' NOT NULL,
>         "mail_va" integer DEFAULT '0' NOT NULL,
>         "authorized_keys" text,
>         "email_new" text,
>         "people_view_skills" integer DEFAULT '0' NOT NULL,
>         "people_resume" text DEFAULT '' NOT NULL,
>         "timezone" character varying(64) DEFAULT 'GMT',
>         "language" integer DEFAULT '1' NOT NULL,
>         "third_party" integer DEFAULT 1 NOT NULL,
>         "personal_status" character(32),
>         "bemsid" integer,
>         "sensitive_info" character(64),
>         "reason_access" text,
>         "organization" text,
>         Constraint "users_pkey" Primary Key ("user_id")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



> );
>

>
> ------------------------------------------------
> Mary Y Wang



--
Adrian Klaver
adrian.klaver@gmail.com

Re: Need to Remove Constraint, but Don't Know How - Previous attempts failed

От
John R Pierce
Дата:
Wang, Mary Y wrote:
> Hi,
>
> I'm sorry but I didn't create the table.  I fiddled with the table for a while and didn't get what I expected.  So
I'mgoing to ask the community. 
>
> Can some one tell me which constraint would case me the "duplicate key into unique index users_pkey"?  I'd like to
removethat constraint. 
>

I only see one constraint on that table, the primary key.

your table's primary key, named users_pkey,  is on user_id.  you want to
have duplicate user_id values in your table ?