Skip to content

Add CURRENT_TIMESTAMP function #12925

@itsjunetime

Description

@itsjunetime

Is your feature request related to a problem or challenge?

Many other databases, such as Postgres, support the common standard function CURRENT_TIMESTAMP, but datafusion does not, as of yet. Support for this function was also mentioned in #251, but not implemented there either. It would be nice to have this function to improve compatibility and make it easier for people who are used to having this function to use datafusion.

Describe the solution you'd like

This should be as easy as adding an override for the aliases function in the impl ScalarUDFImpl for CurrentTimeFunc block. It could just return &["CURRENT_TIMESTAMP".into()], afaict.

Describe alternatives you've considered

None

Additional context

Supporting CURRENT_TIMESTAMP as an alias for now() is even mentioned in the documentation for the aliases function in the ScalarUDFImpl trait definition, so I worry that I am missing some context regarding why CURRENT_TIMESTAMP isn't supported in datafusion yet, but if I am, I can't tell what it is.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions