You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[#23867] YSQL: Support postgres timestamp in YSQL clone AS OF syntax
Summary:
This diff adds support for PG's timestamptz type as the clone time parameter when cloning a
database as of a point in time:
```
CREATE DATABASE db2 TEMPLATE db1 AS OF '2024-09-10 21:52:46.782360';
```
The Unix microseconds timestamp format is still supported.
Jira: DB-12773
Test Plan: `./yb_build.sh release --cxx-test integration-tests_minicluster-snapshot-test --gtest_filter *CloneYsqlSyntax/*`
Reviewers: mhaddad, kfranz
Reviewed By: kfranz
Subscribers: jason, yql, ybase
Differential Revision: https://phorge.dev.yugabyte.com/D42966
In this example, `clone_db` is created as a clone of `original_db`, and contains the latest schema and data of `original_db` as of current time.
73
73
74
-
To create a clone of the original database at a specific point intime (within the history retention period specified when creating the snapshot schedule), you can specify the [Unix timestamp](https://www.unixtimestamp.com/) in microseconds using the `AS OF` option as follows:
74
+
To create a clone of the original database at a specific point intime (within the history retention period specified when creating the snapshot schedule), you can specify a timestamp using the `AS OF` option. The timestamp may be either a [Unix timestamp](https://www.unixtimestamp.com/) in microseconds (as below), or a [PostgreSQL TIMESTAMP](https://www.postgresql.org/docs/current/datatype-datetime.html) in single quotes.
75
75
76
76
```sql
77
77
CREATE DATABASE clone_db TEMPLATE original_db AS OF 1723146703674480;
78
+
# Alternatively:
79
+
CREATE DATABASE clone_db TEMPLATE original_db AS OF '2024-08-08 19:51:43.674480';
0 commit comments