I have a requirement to convert date in source table column to a date time in target.Now, this date time column is part of a composite primary key in target, so if there are any duplicate entry then we have to increase the nanosecond by 1. This has to be done in Postgres CTE for DBT query. Also there can be duplicates in source so to achieve unique value we need to add nanosecond while conversion for duplicate rows.
For eg, 2021-07-30 00:00:00.000000 If more than one row for same effective date then increment nanosecond by 1
Update:- postgres version 11.9