Pseudo-Columns

Pseudo-columns are constants that can be used in expressions like a column from the source. They are specified without parentheses.

ROWNUMBER

ROWNUMBER

The constant ROWNUMBER corresponds to the data row in the source.

If the optional HEADLINE is specified, then the 1st row number corresponds to the 1st row after the header row. Otherwise it is the 1st row in the source.

The result has the data type BIGINT.

Example

SELECT ROWNUMBER, name FROM "chinook.Track.csv" WHERE ROWNUMBER <= 3;

CURRENT_DATE

CURRENT_DATE

The constant CURRENT_DATE corresponds to the current date.

The result has the data type DATE.

Example

SELECT CURRENT_DATE, CURRENT_DATE >= DATE('2020-01-01');

CURRENT_TIMESTAMP

CURRENT_TIMESTAMP

The constant CURRENT_TIMESTAMP corresponds to the current local date and time without time zone.

The result has the data type TIMESTAMP.

Example

SELECT CURRENT_TIMESTAMP, CURRENT_TIMESTAMP > TIMESTAMP('2020-01-01 00:00:00');

DIRECTORY

DIRECTORY

Only with file-based JDBC drivers. The constant DIRECTORY is the directory in which the file is located.

Available as a column of FILES() and, depending on the driver, also when reading a file.

The result has the data type VARCHAR.

FILENAME

FILENAME

Only with file-based JDBC drivers. The constant FILENAME is the filename.

Available as a column of FILES() and, depending on the driver, also when reading a file.

The result has the data type VARCHAR.

FILEDATE

FILEDATE

Only with file-based JDBC drivers. The constant FILEDATE is the file's modification date.

Available as a column of FILES() and, depending on the driver, also when reading a file.

The result has the data type TIMESTAMP.