hasura / hasura/graphql-engine

Cannot Use Postgres CURRENT_TIMESTAMP for Column Default

Open
#7,385 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

# About

When trying to use `CURRENT_TIMESTAMP` as a column default, the Hasura Console errored out. This is a valid function in PG so not sure why it is blocked. I've used `clock_timestamp()` to work around.

https://www.postgresqltutorial.com/postgresql-current_timestamp/

## Steps To Reproduce

* Go to any table with a timestamp with timezone data type (e.g. updated_at or created_at)
* Edit and enter `CURRENT_TIMESTAMP` for default
* Hit Save

## Expected Behavior

Change to be saved

## Actual Behavior

![Screen Shot 2021-08-11 at 2 39 14 PM](https://user-images.githubusercontent.com/134368/129084887-3bca7ca4-df89-47f6-a190-5f6965f97eb5.png)

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure in the Hasura Console using a timestamp-with-timezone column and CURRENT_TIMESTAMP as the default. Trace the Console's handling of the column default, then verify that CURRENT_TIMESTAMP is accepted and the change can be saved without affecting the existing clock_timestamp() workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
database, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.