Derby
  1. Derby
  2. DERBY-52

Cannot create CHAR column with size greater than 254

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.2.0
    • Fix Version/s: 10.1.3.1
    • Component/s: Documentation
    • Labels:
      None
    • Environment:
      Dell Dimension 2350, 2GHz P4, 1 Gig RAM,
      Window XP Pro Version 2002, SP2
      JDK 1.4.2_03, build 1.4.2_03-b02
      Derby Snapshot SVN version 46005 (Binaries)

      Description

      An attempt to create a table that contains a column of type CHAR with a size greater than 254 using the SQL statement

      CREATE TABLE dummyTable ( column1 char(255),column2 char(10),column3 char(10) )

      results in the following SQL Exception:

      SQL Exception: The length, precision, or scale attribute for column, or type mapping 'CHAR(255)' is not valid.
      SQL Error: 30000
      SQL State: 42611

      However, if you decrease column1's length by one as below, the table is created successfully:

      CREATE TABLE dummyTable ( column1 char(254),column2 char(10),column3 char(10) )

      The Derby Reference Manual states that the limit on the length of a CHAR data type is java.lang.Integer.MAX_VALUE:

      http://incubator.apache.org/derby/manuals/reference/sqlj128.html#HDRSII-SQLJ-13733

        Issue Links

          Activity

          Jason Palmatier created issue -
          Hide
          Satheesh Bandaram added a comment -

          I believe the documentation is wrong here... The maximum size of CHAR allowed in Derby is 254, so the documentation needs to be changed.

          Show
          Satheesh Bandaram added a comment - I believe the documentation is wrong here... The maximum size of CHAR allowed in Derby is 254, so the documentation needs to be changed.
          Daniel John Debrunner made changes -
          Field Original Value New Value
          Component/s SQL [ 11408 ]
          Component/s Documentation [ 11406 ]
          Hide
          Jeff Levitt added a comment -

          This has been fixed in the contributed DITA source files for the Derby Reference Manual.

          Show
          Jeff Levitt added a comment - This has been fixed in the contributed DITA source files for the Derby Reference Manual.
          Myrna van Lunteren made changes -
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Resolved [ 5 ]
          Hide
          Jeff Levitt added a comment -

          Fixed in 10.1.0.0

          Show
          Jeff Levitt added a comment - Fixed in 10.1.0.0
          Jeff Levitt made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Alejandro Torras added a comment - - edited

          Same error in Apache Derby - 10.4.1.3 - (648739)


          CREATE TABLE "APP"."TB_CORE_AUTH" ( AUT_CERT CHAR(1244) );

          Error: El atributo de longitud, precisión o escala para columna o correlación de tipo 'CHAR(1244)' no es válido.
          SQLState: 42611
          ErrorCode: -1

          The VARCHAR type worked fine.

          CREATE TABLE "APP"."TB_CORE_AUTH" ( AUT_CERT VARCHAR(1244) );

          Regards.

          Show
          Alejandro Torras added a comment - - edited Same error in Apache Derby - 10.4.1.3 - (648739) — CREATE TABLE "APP"."TB_CORE_AUTH" ( AUT_CERT CHAR(1244) ); Error: El atributo de longitud, precisión o escala para columna o correlación de tipo 'CHAR(1244)' no es válido. SQLState: 42611 ErrorCode: -1 — The VARCHAR type worked fine. CREATE TABLE "APP"."TB_CORE_AUTH" ( AUT_CERT VARCHAR(1244) ); Regards.
          Hide
          Kristian Waagan added a comment -

          The maximum length of the CHAR data type is 254 characters.
          As far as I can see, the reference manual still doesn't specify the maximum length of CHAR correctly in all places.

          Wrong/not-mentioned: http://db.apache.org/derby/docs/dev/ref/ref-single.html#rrefsqlj13733
          Correct: http://db.apache.org/derby/docs/dev/ref/ref-single.html#rrefstringlimits

          I filed DERBY-4025 to get the documentation fixed.

          Show
          Kristian Waagan added a comment - The maximum length of the CHAR data type is 254 characters. As far as I can see, the reference manual still doesn't specify the maximum length of CHAR correctly in all places. Wrong/not-mentioned: http://db.apache.org/derby/docs/dev/ref/ref-single.html#rrefsqlj13733 Correct: http://db.apache.org/derby/docs/dev/ref/ref-single.html#rrefstringlimits I filed DERBY-4025 to get the documentation fixed.
          Kristian Waagan made changes -
          Link This issue relates to DERBY-4025 [ DERBY-4025 ]
          Kathey Marsden made changes -
          Fix Version/s 10.1.3.1 [ 12311953 ]
          Gavin made changes -
          Workflow jira [ 38054 ] Default workflow, editable Closed status [ 12801250 ]

            People

            • Assignee:
              Unassigned
              Reporter:
              Jason Palmatier
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development