Columns Returned by the GetSchemaTable Method
While a PsqlDataReader is open, you can retrieve schema information from the result set. The result set produced for PsqlDataReader.GetSchemaTable() returns the columns described in Table
53
, in the order shown.
Table 53
Columns Returned by GetSchemaTable on PsqlDataReader
Column
Description
ColumnName
Specifies the name of the column, which might not be unique. If the name cannot be determined, a null value is returned. This name reflects the most recent renaming of the column in the current view or command text.
ColumnOrdinal
Specifies the ordinal of the column, which cannot be null. The bookmark column of the row, if any, is 0. Other columns are numbered starting with 1.
ColumnSize
Specifies the maximum possible length of a value in the column. For columns that use a fixed-length data type, this is the size of the data type.
NumericPrecision
Specifies the precision of the column, which depends on how the column is defined in ProviderType.
If ProviderType is a numeric data type, this is the maximum precision of the column.
If ProviderType is not a numeric data type, the value is null.
NumericScale
Specifies the number of digits to the right of the decimal point if ProviderType is DBTYPE_DECIMAL or DBTYPE_NUMERIC. Otherwise, this is a null value.
The value depends on how the column is defined in ProviderType.
DataType
Maps to the .NET Framework type of the column.
ProviderType
Specifies the indicator of the column's data type. This column cannot contain a null value.
If the data type of the column varies from row to row, this must be Object.
IsLong
Set if the column contains a BLOB that contains very long data. The setting of this flag corresponds to the value of the IS_LONG column in the PROVIDER_TYPES rowset for the data type.
The definition of very long data is provider-specific.
AllowDBnull
Set if the consumer can set the column to a null value, or if the data provider cannot determine whether the consumer can set the column to a null value. Otherwise, no value is set.
A column can contain null values, even if it cannot be set to a null value.
IsReadOnly
Determines whether a column can be changed.
The value is true if the column can be modified; otherwise, the value is false.
IsRowVersion
Is set if the column contains a persistent row identifier that cannot be written to, and has no meaningful value except to identify the row.
IsUnique
Specifies whether the column constitutes a key by itself or if there is a constraint of type UNIQUE that applies only to this column.
If set to true, no two rows in the base table (the table returned in BaseTableName) can have the same value in this column.
If set to false (the initial default), the column can contain duplicate values in the base table.
IsKey
Specifies whether a set of columns uniquely identifies a row in the rowset. This set of columns may be generated from a base table primary key, a unique constraint, or a unique index.
The value is true if the column is one of a set of columns in the rowset that, taken together, uniquely identify the row. The value is false if the column is not required to uniquely identify the row.
IsAutoIncrement
Specifies whether the column assigns values to new rows in fixed increments.
If set to VARIANT_TRUE, the column assigns values to new rows in fixed increments.
If set to VARIANT_FALSE (the initial default), the column does not assign values to new rows in fixed increments.
BaseSchemaName
Specifies the name of the schema in the database that contains the column. The value is null if the base schema name cannot be determined.
The initial default is null.
BaseCatalogName
Specifies the name of the catalog in the data store that contains the column. A null value is used if the base catalog name cannot be determined.
The initial default is null.
BaseTableName
Specifies the name of the table or view in the data store that contains the column. A null value is used if the base table name cannot be determined.
The initial default is null.
BaseColumnName
Specifies the name of the column in the data store. This might be different than the column name returned in the ColumnName column if an alias was used. A null value is used if the base column name cannot be determined or if the rowset column is derived from, but is not identical to, a column in the database.
The initial default is null.
IsAliased
Specifies whether the name of the column is an alias. The value true is returned if the column name is an alias; otherwise, false is returned.
IsExpression
Specifies whether the name of the column is an expression. The value true is returned if the column is an expression; otherwise, false is returned.
IsIdentity
Specifies whether the name of the column is an identity column. The value true is returned if the column is an identity column; otherwise, false is returned.
IsHidden
Specifies whether the name of the column is hidden. The value true is returned if the column is hidden; otherwise, false is returned.