Skip to main content

SQL Column Types

MySQL/MariaDB

HCLSQLAttributesExample
bigintbigint
  • unsigned (bool)
  • size (int)
type = bigint(255)
unsigned = true
binarybinary
  • size (int)
type = binary(255)
bitbit
  • size (int)
type = bit(255)
blobblob
  • size (int)
type = blob(255)
boolbool
    type = bool
    booleanboolean
      type = boolean
      charchar
      • size (int)
      type = char(255)
      datedate
      • precision (int)
      type = date(10)
      datetimedatetime
      • precision (int)
      type = datetime(10)
      decimaldecimal
      • unsigned (bool)
      • precision (int)
      • scale (int)
      type = decimal(10,2)
      unsigned = true
      doubledouble
      • unsigned (bool)
      • precision (int)
      • scale (int)
      type = double(10,2)
      unsigned = true
      enumenum
      • values (slice)
      type = enum("a","b")
      floatfloat
      • unsigned (bool)
      • precision (int)
      • scale (int)
      type = float(10,2)
      unsigned = true
      geometrygeometry
        type = geometry
        geometrycollectiongeometrycollection
          type = geometrycollection
          intint
          • unsigned (bool)
          • size (int)
          type = int(255)
          unsigned = true
          jsonjson
            type = json
            linestringlinestring
              type = linestring
              longbloblongblob
                type = longblob
                longtextlongtext
                  type = longtext
                  mediumblobmediumblob
                    type = mediumblob
                    mediumintmediumint
                    • unsigned (bool)
                    • size (int)
                    type = mediumint(255)
                    unsigned = true
                    mediumtextmediumtext
                      type = mediumtext
                      multilinestringmultilinestring
                        type = multilinestring
                        multipointmultipoint
                          type = multipoint
                          multipolygonmultipolygon
                            type = multipolygon
                            numericnumeric
                            • unsigned (bool)
                            • precision (int)
                            • scale (int)
                            type = numeric(10,2)
                            unsigned = true
                            pointpoint
                              type = point
                              polygonpolygon
                                type = polygon
                                realreal
                                • unsigned (bool)
                                • precision (int)
                                • scale (int)
                                type = real(10,2)
                                unsigned = true
                                setset
                                • values (slice)
                                type = set("a","b")
                                smallintsmallint
                                • unsigned (bool)
                                • size (int)
                                type = smallint(255)
                                unsigned = true
                                texttext
                                • size (int)
                                type = text(255)
                                timetime
                                • precision (int)
                                type = time(10)
                                timestamptimestamp
                                • precision (int)
                                type = timestamp(10)
                                tinyblobtinyblob
                                  type = tinyblob
                                  tinyinttinyint
                                  • unsigned (bool)
                                  • size (int)
                                  type = tinyint(255)
                                  unsigned = true
                                  tinytexttinytext
                                    type = tinytext
                                    varbinaryvarbinary
                                    • size (int)
                                    type = varbinary(255)
                                    varcharvarchar
                                    • size (int)
                                    type = varchar(255)
                                    yearyear
                                    • precision (int)
                                    type = year(10)

                                    Postgres

                                    HCLSQLAttributesExample
                                    bigintbigint
                                      type = bigint
                                      bigserialbigserial
                                        type = bigserial
                                        bitbit
                                        • len (int64)
                                        type = bit(255)
                                        bit_varyingbit varying
                                        • len (int64)
                                        type = bit_varying(255)
                                        boolbool
                                          type = bool
                                          booleanboolean
                                            type = boolean
                                            boxbox
                                              type = box
                                              byteabytea
                                                type = bytea
                                                charchar
                                                • size (int)
                                                type = char(255)
                                                charactercharacter
                                                • size (int)
                                                type = character(255)
                                                character_varyingcharacter varying
                                                • size (int)
                                                type = character_varying(255)
                                                cidrcidr
                                                  type = cidr
                                                  circlecircle
                                                    type = circle
                                                    datedate
                                                      type = date
                                                      decimaldecimal
                                                        type = decimal
                                                        double_precisiondouble precision
                                                          type = double_precision
                                                          enummy_enum
                                                            enum = enum.my_enum
                                                            In Postgres an enum type is created as a custom type and can then be referenced in a column definition. Therefore, you have to add an enum block to your HCL schema like below:
                                                            enum "my_enum" { values = ["on", "off"] }
                                                            float4float4
                                                              type = float4
                                                              float8float8
                                                                type = float8
                                                                hstorehstore
                                                                  type = hstore
                                                                  inetinet
                                                                    type = inet
                                                                    intint
                                                                      type = int
                                                                      int2int2
                                                                        type = int2
                                                                        int4int4
                                                                          type = int4
                                                                          int8int8
                                                                            type = int8
                                                                            integerinteger
                                                                              type = integer
                                                                              jsonjson
                                                                                type = json
                                                                                jsonbjsonb
                                                                                  type = jsonb
                                                                                  lineline
                                                                                    type = line
                                                                                    lseglseg
                                                                                      type = lseg
                                                                                      macaddrmacaddr
                                                                                        type = macaddr
                                                                                        macaddr8macaddr8
                                                                                          type = macaddr8
                                                                                          moneymoney
                                                                                            type = money
                                                                                            numericnumeric
                                                                                              type = numeric
                                                                                              pathpath
                                                                                                type = path
                                                                                                pointpoint
                                                                                                  type = point
                                                                                                  realreal
                                                                                                    type = real
                                                                                                    serialserial
                                                                                                      type = serial
                                                                                                      serial2serial2
                                                                                                        type = serial2
                                                                                                        serial4serial4
                                                                                                          type = serial4
                                                                                                          serial8serial8
                                                                                                            type = serial8
                                                                                                            smallintsmallint
                                                                                                              type = smallint
                                                                                                              smallserialsmallserial
                                                                                                                type = smallserial
                                                                                                                sqlsql
                                                                                                                • def (string)
                                                                                                                type = sql("a")
                                                                                                                texttext
                                                                                                                  type = text
                                                                                                                  timetime
                                                                                                                  • precision (int)
                                                                                                                  type = time(10)
                                                                                                                  timestamptimestamp
                                                                                                                  • precision (int)
                                                                                                                  type = timestamp(10)
                                                                                                                  timestamptztimestamptz
                                                                                                                  • precision (int)
                                                                                                                  type = timestamptz(10)
                                                                                                                  timetztimetz
                                                                                                                  • precision (int)
                                                                                                                  type = timetz(10)
                                                                                                                  uuiduuid
                                                                                                                    type = uuid
                                                                                                                    varcharvarchar
                                                                                                                    • size (int)
                                                                                                                    type = varchar(255)
                                                                                                                    xmlxml
                                                                                                                      type = xml

                                                                                                                      SQLite

                                                                                                                      HCLSQLAttributesExample
                                                                                                                      bigintbigint
                                                                                                                      • size (int)
                                                                                                                      type = bigint(255)
                                                                                                                      blobblob
                                                                                                                      • size (int)
                                                                                                                      type = blob(255)
                                                                                                                      booleanboolean
                                                                                                                        type = boolean
                                                                                                                        charactercharacter
                                                                                                                        • size (int)
                                                                                                                        type = character(255)
                                                                                                                        clobclob
                                                                                                                        • size (int)
                                                                                                                        type = clob(255)
                                                                                                                        datedate
                                                                                                                          type = date
                                                                                                                          datetimedatetime
                                                                                                                            type = datetime
                                                                                                                            decimaldecimal
                                                                                                                            • precision (int)
                                                                                                                            • scale (int)
                                                                                                                            type = decimal(10,2)
                                                                                                                            doubledouble
                                                                                                                            • size (int)
                                                                                                                            type = double(255)
                                                                                                                            double_precisiondouble precision
                                                                                                                            • size (int)
                                                                                                                            type = double_precision(255)
                                                                                                                            floatfloat
                                                                                                                            • size (int)
                                                                                                                            type = float(255)
                                                                                                                            intint
                                                                                                                            • size (int)
                                                                                                                            type = int(255)
                                                                                                                            int2int2
                                                                                                                            • size (int)
                                                                                                                            type = int2(255)
                                                                                                                            int8int8
                                                                                                                            • size (int)
                                                                                                                            type = int8(255)
                                                                                                                            integerinteger
                                                                                                                            • size (int)
                                                                                                                            type = integer(255)
                                                                                                                            jsonjson
                                                                                                                              type = json
                                                                                                                              mediumintmediumint
                                                                                                                              • size (int)
                                                                                                                              type = mediumint(255)
                                                                                                                              native_characternative character
                                                                                                                              • size (int)
                                                                                                                              type = native_character(255)
                                                                                                                              ncharnchar
                                                                                                                              • size (int)
                                                                                                                              type = nchar(255)
                                                                                                                              numericnumeric
                                                                                                                              • precision (int)
                                                                                                                              • scale (int)
                                                                                                                              type = numeric(10,2)
                                                                                                                              nvarcharnvarchar
                                                                                                                              • size (int)
                                                                                                                              type = nvarchar(255)
                                                                                                                              realreal
                                                                                                                              • precision (int)
                                                                                                                              • scale (int)
                                                                                                                              type = real(10,2)
                                                                                                                              smallintsmallint
                                                                                                                              • size (int)
                                                                                                                              type = smallint(255)
                                                                                                                              texttext
                                                                                                                              • size (int)
                                                                                                                              type = text(255)
                                                                                                                              tinyinttinyint
                                                                                                                              • size (int)
                                                                                                                              type = tinyint(255)
                                                                                                                              unsigned_big_intunsigned big int
                                                                                                                              • size (int)
                                                                                                                              type = unsigned_big_int(255)
                                                                                                                              uuiduuid
                                                                                                                                type = uuid
                                                                                                                                varcharvarchar
                                                                                                                                • size (int)
                                                                                                                                type = varchar(255)
                                                                                                                                varying_charactervarying character
                                                                                                                                • size (int)
                                                                                                                                type = varying_character(255)