interval_forbid_composite_literals - Amazon Redshift
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

interval_forbid_composite_literals

Values (default in bold)

false, true

Description

A session configuration that modifies the value of an interval that contain both YEAR TO MONTH and DAY TO SECOND parts.

If interval_forbid_composite_literals is true, an error is returned if an interval with both YEAR TO MONTH and DAY TO SECOND parts is encountered. For example, the following SQL contains an INTERVAL DAY TO SECOND with both YEAR TO MONTH and DAY TO SECOND parts.

SELECT INTERVAL '1 year 1 day' DAY TO SECOND; ERROR: Interval Day To Second literal cannot contain year-month parts. Disable the GUC interval_forbid_composite_literals to suppress this error and silently discard the year-month part.

If interval_forbid_composite_literals is false, Amazon Redshift suppresses an error and truncates the YEAR TO MONTH part from an INTERVAL DAY TO SECOND value. For example, the following SQL contains an INTERVAL DAY TO SECOND with both YEAR TO MONTH and DAY TO SECOND parts.

SET interval_forbid_composite_literals to "false"; SELECT INTERVAL '1 year 1 day' DAY TO SECOND; intervald2s ------------------------------ 1 days 0 hours 0 mins 0.0 secs