Skip to content

bug: DATE_TRUNC('SECOND', <timestamp column>) fails with “function ... is not unique” in Snowflake emulation #13715

@yahyaakli

Description

@yahyaakli

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When running a simple query that uses DATE_TRUNC against a table/view in LocalStack’s Snowflake emulation, LocalStack errors with:

function DATE_TRUNC(snowflakevarchar, snowflakevarchar) is not unique
Could not choose a best candidate function. You might need to add explicit type casts.

The same query works on real Snowflake. This looks like an overload-resolution / type-inference issue where the second argument is being treated as snowflakevarchar (text) instead of a timestamp.

The error I get
Error: {'S': 'ERROR', 'V': 'ERROR', 'C': '42725', 'M': 'function DATE_TRUNC(snowflakevarchar, snowflakevarchar) is not unique', 'H': 'Could not choose a best candidate function. You might need to add explicit type casts.', 'P': '8', 'F': 'parse_func.c', 'L': '570', 'R': 'ParseFuncOrColumn'}

Expected Behavior

  • DATE_TRUNC('SECOND', INTERVAL_UTC) should work when INTERVAL_UTC is a timestamp column (or is represented as such in the Snowflake emulation), matching Snowflake behavior.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

With a docker-compose file

Example that can reproduce the same issue:

WITH fake_bulk_data AS (
  SELECT column1 AS interval_utc
  FROM VALUES ('2025-08-22 04:00:00 Z')
)
SELECT DATE_TRUNC('SECOND', interval_utc) AS t
FROM fake_bulk_data;

Environment

- OS: Mac
- LocalStack:
  LocalStack version: latest
  LocalStack Docker image sha: sha256:b10d4627a112317e24ba28e16af9a2b49357ca58f4ee684313addd0ff0878ccd
  LocalStack build date: 2026-01-22T16:28:00.632921Z

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Snowflake: generalIssues related to LocalStack for Snowflake emulatorstatus: backlogTriaged but not yet being worked ontype: bugBug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions