RDB$FIELDS

From InterBase
Jump to: navigation, search

Go Up to System Tables


RDB$FIELDS defines the characteristics of a column. Each domain or column has a corresponding row in RDB$FIELDS. Columns are added to tables by means of an entry in the RDB$RELATION_FIELDS table, which describes local characteristics.

For domains, RDB$FIELDS includes domain name, null status, and default values. SQL columns are defined in RDB$RELATION_FIELDS. For both domains and simple columns, RDB$RELATION_FIELDS can contain default and null status information.

Column name Data Type Length Description

RDB$FIELD_NAME

CHAR

67

Unique name of a domain or system-assigned name for a column, starting with SQL<nnn>; the actual column names are stored in the RDB$FIELD_SOURCE column of RDB$RELATION_FIELDS.

RDB$QUERY_NAME

CHAR

67

Not used for SQL objects.

RDB$VALIDATION_BLR

BLOB

Not used for SQL objects.

RDB$VALIDATION_SOURCE

BLOB

Not used for SQL objects.

RDB$COMPUTED_BLR

BLOB

Subtype BLR; for computed columns, contains the BLR (Binary Language Representation) of the expression the database evaluates at the time of execution.

RDB$COMPUTED_SOURCE

BLOB

Subtype Text: For computed columns, contains the original CHAR source expression for the column.

RDB$DEFAULT_VALUE

BLOB

Stores default rule; subtype BLR.

RDB$DEFAULT_SOURCE

BLOB

Subtype Text; SQL description of a default value.

RDB$FIELD_LENGTH

SMALLINT

Length in bytes of the field this row defines:

For CHAR, VARCHAR, and NCHAR data types, this is the maximum length of the field, and InterBase uses this length when creating indexes on columns.

For non-CHAR related data types, the column lengths are:

  • D_FLOAT - 8
  • DOUBLE - 8
  • DATE - 4
  • BLOB - 8
  • TIME - 4
  • INT64 - 8
  • SHORT - 2
  • LONG - 4
  • QUAD - 8
  • FLOAT - 4
  • TIMESTAMP - 8
  • BOOLEAN - 2

RDB$FIELD_PRECISION

SMALLINT

Stores the precision for numeric and decimal types.

RDB$FIELD_SCALE

SMALLINT

Stores negative scale for numeric and decimal types.

RDB$FIELD_TYPE

SMALLINT

Specifies the data type of the column being defined; changing the value of this column automatically changes the data type for all columns based on the column being defined.

Valid values are:

  • BLOB - 261
  • BLOB_ID - 45
  • BOOLEAN - 17
  • CHAR - 14
  • CSTRING - 40
  • D_FLOAT - 11
  • DOUBLE - 27
  • FLOAT - 10
  • INT64 - 16
  • INTEGER - 8
  • QUAD - 9
  • SMALLINT - 7
  • DATE - 12
    (dialect 3 DATE)
  • TIME - 13
  • TIMESTAMP - 35
  • VARCHAR - 37


Restrictions:

  • The value of this column cannot be changed to or from BLOB.
  • Non-numeric data causes a conversion error in a column changed from CHAR to numeric.

Changing data from CHAR to numeric and back again adversely affects index performance; for best results, delete and re-create indexes when making this type of change.

RDB$FIELD_SUB_TYPE

SMALLINT

Used to distinguish types of Blobs, CHAR values, and integers.

1 If RDB$FIELD_TYPE is 261 (Blob), predefined subtypes can be:

  • 0 - unspecified
  • 1 - text
  • 2 - BLR (Binary Language Representation)
  • 3 - access control list
  • 4 - reserved for future use
  • 5 - encoded description of a table’s current metadata
  • 6 - description of multi-database transaction that finished irregularly


2 If RDB$FIELD_TYPE is 14 (CHAR), columns can be:

  • 0 - type is unspecified
  • 1 - fixed BINARY data

Corresponds to the RDB$FIELD_SUB_TYPE column in the RDB$COLLATIONS table.

3 If RDB$FIELD_TYPE is 7 (SMALLINT), 8 (INTEGER), or 16 (INT64), the original declaration was:

  • 0 or NULL- RDB$FIELD_TYPE
  • 1 - NUMERIC
  • 2 - DECIMAL

RDB$MISSING_VALUE

BLOB

Not used for SQL objects.

RDB$MISSING_SOURCE

BLOB

Not used for SQL objects.

RDB$DESCRIPTION

BLOB

Subtype Text: Contains a user-written description of the column being defined.

RDB$SYSTEM_FLAG

SMALLINT

For system tables

RDB$QUERY_HEADER

BLOB

Not used for SQL objects.

RDB$SEGMENT_LENGTH

SMALLINT

Used for Blob columns only; a non-binding suggestion for the length of Blob buffers.

RDB$EDIT_STRING

VARCHAR

125

Not used for SQL objects.

RDB$EXTERNAL_LENGTH

SMALLINT

Length of the column as it exists in an external table; if the column is not in an external table, this value is 0.

RDB$EXTERNAL_SCALE

SMALLINT

Scale factor for an external column of an integer data type; the scale factor is the power of 10 by which the integer is multiplied.

RDB$EXTERNAL_TYPE

SMALLINT

Indicates the data type of the column as it exists in an external table; valid values are:

  • BLOB - 261
  • BLOB_ID - 45
  • BOOLEAN - 17
  • CHAR - 14
  • CSTRING - 40
  • D_FLOAT - 11
  • DOUBLE - 27
  • FLOAT - 10
  • INT64 - 16
  • INTEGER - 8
  • QUAD - 9
  • SMALLINT - 7
  • DATE - 12
    (dialect 3 DATE)
  • TIME - 13
  • TIMESTAMP - 35
  • VARCHAR - 37

RDB$DIMENSIONS

SMALLINT

For an ARRAY data type, specifies the number of dimensions in the array; for a non-array column, the value is 0.

RDB$NULL_FLAG

SMALLINT

Indicates whether a column can contain a NULL value.

Valid values are:

  • Empty: Can contain NULL values.
  • 1: Cannot contain NULL values.

RDB$CHARACTER_LENGTH

SMALLINT

Length in characters of the field this row defines:

For CHAR, VARCHAR, and NCHAR data types, this is the quotient of RDB$FIELD_LENGTH divided by the number of bytes per character in the character set of the field. For other data types, this length value is not meaningful, and should be NULL.

RDB$COLLATION_ID

SMALLINT

Unique identifier for the collation sequence.

RDB$CHARACTER_SET_ID

SMALLINT

ID indicating character set for the character or Blob columns; joins to the CHARACTER_SET_ID column of the RDB$CHARACTER_SETS system table.

RDB$SUBSCRIBE_FLAG

SMALLINT

2

Indicates one or more subscriptions of the field.