Skip to content

nullif(x,x) == null? #6779

Answered by dbeatty10
RobbertDM asked this question in Q&A
Jan 30, 2023 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Those are some very sharp eagle eyes @RobbertDM ! 🦅

Caveat: all the commentary that follows is my best guess from reading the relevant code -- I didn't actually test any of this out to be certain.

TL;DR

In the initial snapshot, dbt_valid_to will be null for all rows. This nullif trick forces the cast to the same data type as dbt_valid_from rather than the database choosing some other unintended/incompatible data type.

null sounds about right

I think the answer is "yes!" it will always evaluate to null. But I suspect that it isn't just any null, it's a null with the same data type as the strategy.updated_at column/expression.

So if strategy.updated_at has a datatype of timestamp, then I'm …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RobbertDM
Comment options

Answer selected by RobbertDM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants