handleToDate converts PostgreSQL to_date(text, format) to strptime with converted format.
(fc *pg_query.FuncCall, funcNameIdx int)
| 472 | |
| 473 | // handleToDate converts PostgreSQL to_date(text, format) to strptime with converted format. |
| 474 | func (t *FunctionTransform) handleToDate(fc *pg_query.FuncCall, funcNameIdx int) bool { |
| 475 | if len(fc.Args) != 2 { |
| 476 | return false |
| 477 | } |
| 478 | formatStr := extractStringConstant(fc.Args[1]) |
| 479 | if formatStr != "" { |
| 480 | setStringConstant(fc.Args[1], pgDateFormatToStrftime(formatStr)) |
| 481 | } |
| 482 | renameFuncAndStripPrefix(fc, funcNameIdx, "strptime") |
| 483 | return true |
| 484 | } |
| 485 | |
| 486 | // handleToTimestamp converts 2-arg PostgreSQL to_timestamp(text, format) to strptime. |
| 487 | // 1-arg to_timestamp(epoch) is left unchanged (DuckDB handles it natively). |
no test coverage detected