Name

short_column_names — Control column-name format used in queries

Common Usage

PRAGMA short_column_names;
PRAGMA short_column_names = switch;

Description

The short_column_names pragma, in conjunction with the full_column_names pragma, controls how the database connection specifies and formats column names in result sets. If short_column_name is enabled, output column expressions that consist of a single named table column will be clipped to only include the column name. This pragma is on by default.

The general rules for output names are:

  • If an output column has an AS name clause, name is used.

  • If short_column_names is enabled and the output column is an unmodified source column, the result set column name is column_name .

  • If full_column_names is enabled and the output column is an unmodified source column, the result set column name is table_name.column_name.

  • The result set column name is the text of the column expression, as given.

If full_column_names and short_column_names are both enabled, short_column_names will override full_column_names.

Note that there is no guarantee the result set column names will remain consistent with future versions of SQLite. If your application depends on specific, recognizable column names, you should use an AS clause.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.