SSC-FDM-PG0010

Results may vary due to the behavior of Snowflake's bitwise function.

Description

The bitwise operators << and >> are converted to the corresponding Snowflake functions BITSHIFTLEFT and BITSHIFTRIGHT. However, due to differences in how these functions handle expressions, the results may differ from those in PostgreSQL.

Code Example

Input Code:

IN -> PostgreSQL_01.sql
SELECT 1 << 127 AS resultShiftedLeft, 16 >> 32 AS resultShiftedRight;

Output Code:

OUT -> PostgreSQL_01.sql
SELECT
--** SSC-FDM-PG0010 - RESULTS MAY VARY DUE TO THE BEHAVIOR OF SNOWFLAKE'S BITSHIFTLEFT BITWISE FUNCTION **
BITSHIFTLEFT( 1, 127) AS resultShiftedLeft,
--** SSC-FDM-PG0010 - RESULTS MAY VARY DUE TO THE BEHAVIOR OF SNOWFLAKE'S BITSHIFTRIGHT BITWISE FUNCTION **
BITSHIFTRIGHT( 16, 32) AS resultShiftedRight;

Recommendations

Last updated