Primary Key error wrong number of qualifiers

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sachin

    Primary Key error wrong number of qualifiers

    Hi,
    I am facing some strange issue in DB2 UDB 9.5.1

    I have created a database on DPF implemented environment and I tried
    to execute following commands

    Db2 create table test ( name char(10) not null, acno integer not
    null );
    Completed successfuly

    Db2 alter table test add constraint PK_test primary key ( acno );
    DB21034E The command was processed as an SQL statement because it was
    not a
    valid Command Line Processor command. During SQL processing it
    returned:
    SQL0108N The name "PK_TEST" has the wrong number of qualifiers.
    SQLSTATE=42601

    But if I create primary key on first column ( Db2 alter table test add
    constraint PK_test primary key ( name ))
    it works fine. I am not sure whether it is related to DPF or Db2
    version.

    Please help.

    Regards
    Sachin Shinde

  • Serge Rielau

    #2
    Re: Primary Key error wrong number of qualifiers

    sachin wrote:
    Hi,
    I am facing some strange issue in DB2 UDB 9.5.1
    >
    I have created a database on DPF implemented environment and I tried
    to execute following commands
    >
    Db2 create table test ( name char(10) not null, acno integer not
    null );
    Completed successfuly
    >
    Db2 alter table test add constraint PK_test primary key ( acno );
    DB21034E The command was processed as an SQL statement because it was
    not a
    valid Command Line Processor command. During SQL processing it
    returned:
    SQL0108N The name "PK_TEST" has the wrong number of qualifiers.
    SQLSTATE=42601
    >
    But if I create primary key on first column ( Db2 alter table test add
    constraint PK_test primary key ( name ))
    it works fine. I am not sure whether it is related to DPF or Db2
    version.
    Is this the exact statement or have you sanitized it?
    This error is raised if you give a "one part name" a "dot".
    Your _example_ looks sound.

    Cheers
    Serge


    --
    Serge Rielau
    DB2 Solutions Development
    IBM Toronto Lab

    Comment

    • sachin

      #3
      Re: Primary Key error wrong number of qualifiers

      On Sep 20, 6:06 pm, Serge Rielau <srie...@ca.ibm .comwrote:
      sachin wrote:
      Hi,
      I am facing some strange issue in DB2 UDB 9.5.1
      >
      I have created a database on DPF implemented environment and I tried
      to execute following commands
      >
      Db2 create table test ( name char(10) not null, acno integer not
      null );
      Completed successfuly
      >
      Db2 alter table test add constraint PK_test primary key ( acno );
      DB21034E  The command was processed as an SQL statement because it was
      not a
      valid Command Line Processor command.  During SQL processing it
      returned:
      SQL0108N  The name "PK_TEST" has the wrong number of qualifiers.
      SQLSTATE=42601
      >
      But if I create primary key on first column ( Db2 alter table test add
      constraint PK_test primary key ( name ))
      it works fine. I am not sure whether it is related to DPF or Db2
      version.
      >
      Is this the exact statement or have you sanitized it?
      This error is raised if you give a "one part name" a "dot".
      Your _example_ looks sound.
      >
      Cheers
      Serge
      >
      --
      Serge Rielau
      DB2 Solutions Development
      IBM Toronto Lab- Hide quoted text -
      >
      - Show quoted text -
      Hi
      It's complete error...I am also facing another related issue also... i
      think it's related to this only...
      i am not able to create 2 unique indexes on this. Facing following
      error

      DB21034E The command was processed as an SQL statement because it was
      not a
      valid Command Line Processor command. During SQL processing it
      returned:
      SQL0270N Function not supported (Reason code = "1"). SQLSTATE=42997

      i could create the same on non DPF database which is on windows and
      DPF database is on linux.

      regards
      sachin shinde

      Comment

      • Ian

        #4
        Re: Primary Key error wrong number of qualifiers

        sachin wrote:
        Hi,
        I am facing some strange issue in DB2 UDB 9.5.1
        >
        I have created a database on DPF implemented environment and I tried
        to execute following commands
        >
        Db2 create table test ( name char(10) not null, acno integer not
        null );
        Completed successfuly
        >
        Db2 alter table test add constraint PK_test primary key ( acno );
        DB21034E The command was processed as an SQL statement because it was
        not a
        valid Command Line Processor command. During SQL processing it
        returned:
        SQL0108N The name "PK_TEST" has the wrong number of qualifiers.
        SQLSTATE=42601
        >
        But if I create primary key on first column ( Db2 alter table test add
        constraint PK_test primary key ( name ))
        it works fine. I am not sure whether it is related to DPF or Db2
        version.
        This is DPF.

        I suggest you read the documentation about the requirements for
        partitioning keys and their relationship to unique indexes (i.e. primary
        key or other unique keys).

        While you're at it, read up on how DB2 selects a partitioning key if you
        don't specify one explicitly.


        In short: Unique indexes must include all column(s) used as the
        partitioning key. The partitioning key may be a subset of the columns
        in the unique index.


        Comment

        • sachin

          #5
          Re: Primary Key error wrong number of qualifiers

          On Sep 21, 4:26 am, Ian <ianb...@mobile audio.comwrote:
          sachin wrote:
          Hi,
          I am facing some strange issue in DB2 UDB 9.5.1
          >
          I have created a database on DPF implemented environment and I tried
          to execute following commands
          >
          Db2 create table test ( name char(10) not null, acno integer not
          null );
          Completed successfuly
          >
          Db2 alter table test add constraint PK_test primary key ( acno );
          DB21034E  The command was processed as an SQL statement because it was
          not a
          valid Command Line Processor command.  During SQL processing it
          returned:
          SQL0108N  The name "PK_TEST" has the wrong number of qualifiers.
          SQLSTATE=42601
          >
          But if I create primary key on first column ( Db2 alter table test add
          constraint PK_test primary key ( name ))
          it works fine. I am not sure whether it is related to DPF or Db2
          version.
          >
          This is DPF.
          >
          I suggest you read the documentation about the requirements for
          partitioning keys and their relationship to unique indexes (i.e. primary
          key or other unique keys).
          >
          While you're at it, read up on how DB2 selects a partitioning key if you
          don't specify one explicitly.
          >
          In short:  Unique indexes must include all column(s) used as the
          partitioning key.  The partitioning key may be a subset of the columns
          in the unique index.- Hide quoted text -
          >
          - Show quoted text -
          Hi

          Unique index key on partitioned table should include columns used for
          partitioning. But in my above example i am not creating partitioned
          table also. It's normal table only. only implementation done is
          database partitioning on instance level.

          Regards
          Sachin Shinde

          Comment

          • Ian

            #6
            Re: Primary Key error wrong number of qualifiers

            sachin wrote:
            On Sep 21, 4:26 am, Ian <ianb...@mobile audio.comwrote:
            >sachin wrote:
            >>Hi,
            >>I am facing some strange issue in DB2 UDB 9.5.1
            >>I have created a database on DPF implemented environment and I tried
            >>to execute following commands
            >>Db2 create table test ( name char(10) not null, acno integer not
            >>null );
            >>Completed successfuly
            >>Db2 alter table test add constraint PK_test primary key ( acno );
            >>DB21034E The command was processed as an SQL statement because it was
            >>not a
            >>valid Command Line Processor command. During SQL processing it
            >>returned:
            >>SQL0108N The name "PK_TEST" has the wrong number of qualifiers.
            >>SQLSTATE=4260 1
            >>But if I create primary key on first column ( Db2 alter table test add
            >>constraint PK_test primary key ( name ))
            >>it works fine. I am not sure whether it is related to DPF or Db2
            >>version.
            >This is DPF.
            >>
            >I suggest you read the documentation about the requirements for
            >partitioning keys and their relationship to unique indexes (i.e. primary
            >key or other unique keys).
            >>
            >While you're at it, read up on how DB2 selects a partitioning key if you
            >don't specify one explicitly.
            >>
            >In short: Unique indexes must include all column(s) used as the
            >partitioning key. The partitioning key may be a subset of the columns
            >in the unique index.- Hide quoted text -
            >>
            >- Show quoted text -
            >
            Hi
            >
            Unique index key on partitioned table should include columns used for
            partitioning. But in my above example i am not creating partitioned
            table also. It's normal table only. only implementation done is
            database partitioning on instance level.
            It sounds like you don't understand what database partitioning is. I
            recommend you read the manuals or other articles so you understand
            what exactly DPF is. Here is an introductory article:




            Note, DPF is not the same thing as range partitioned tables.

            Comment

            • sachin

              #7
              Re: Primary Key error wrong number of qualifiers

              On Sep 23, 9:17 am, Ian <ianb...@mobile audio.comwrote:
              sachin wrote:
              On Sep 21, 4:26 am, Ian <ianb...@mobile audio.comwrote:
              sachin wrote:
              >Hi,
              >I am facing some strange issue in DB2 UDB 9.5.1
              >I have created a database on DPF implemented environment and I tried
              >to execute following commands
              >Db2 create table test ( name char(10) not null, acno integer not
              >null );
              >Completed successfuly
              >Db2 alter table test add constraint PK_test primary key ( acno );
              >DB21034E  The command was processed as an SQL statement because it was
              >not a
              >valid Command Line Processor command.  During SQL processing it
              >returned:
              >SQL0108N  The name "PK_TEST" has the wrong number of qualifiers.
              >SQLSTATE=426 01
              >But if I create primary key on first column ( Db2 alter table test add
              >constraint PK_test primary key ( name ))
              >it works fine. I am not sure whether it is related to DPF or Db2
              >version.
              This is DPF.
              >
              I suggest you read the documentation about the requirements for
              partitioning keys and their relationship to unique indexes (i.e. primary
              key or other unique keys).
              >
              While you're at it, read up on how DB2 selects a partitioning key if you
              don't specify one explicitly.
              >
              In short:  Unique indexes must include all column(s) used as the
              partitioning key.  The partitioning key may be a subset of the columns
              in the unique index.- Hide quoted text -
              >
              - Show quoted text -
              >
              Hi
              >
              Unique index key on partitioned table should include columns used for
              partitioning. But in my above example i am not creating partitioned
              table also. It's normal table only. only implementation done is
              database partitioning on instance level.
              >
              It sounds like you don't understand what database partitioning is.  I
              recommend you read the manuals or other articles so you understand
              what exactly DPF is.  Here is an introductory article:
              >
              http://www.ibm.com/developerworks/db...le/dm-0405wilk...
              >
              Note, DPF is not the same thing as range partitioned tables.- Hide quotedtext -
              >
              - Show quoted text -
              Hi,

              Thanks for reply.

              I got the problem. I never considered that DB2 distributing every row
              in the table by default without mentioning the distribute by clause.
              If we don't mention the same while creating the table, it does select
              by it's own which we may not use as subset in primary key OR unique
              index.
              In DPF environment, wee should always use distribute by clause to
              avoid this kind of issues.

              Thanks once again.

              Regards
              Sachin Shinde

              Comment

              Working...