Skip to content

Commit

Permalink
sql: version gate casting to pg_lsn
Browse files Browse the repository at this point in the history
Informs cockroachdb#105130

Release note: None
  • Loading branch information
otan committed Jun 26, 2023
1 parent 19b67e3 commit 1ea9749
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/sql/logictest/testdata/logic_test/pg_lsn_mixed
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# LogicTest: local-mixed-22.2-23.1
# TODO(otan): add tests for mixed 23.1-23.2.

query T
SELECT '1010F/AAAA'::pg_lsn
----
1010F/AAAA
statement error must be finalized to use pg_lsn
SELECT '1010F/AAAA'::text::pg_lsn

statement error pg_lsn not supported until version 23.2
CREATE TABLE pg_lsn_table(id pg_lsn, val pg_lsn)
5 changes: 5 additions & 0 deletions pkg/sql/sem/eval/cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ func performCastWithoutPrecisionTruncation(
}

case types.PGLSNFamily:
if !evalCtx.Settings.Version.IsActive(ctx, clusterversion.V23_2) {
return nil, pgerror.Newf(pgcode.FeatureNotSupported,
"version %v must be finalized to use pg_lsn",
clusterversion.ByKey(clusterversion.V23_2))
}
switch d := d.(type) {
case *tree.DString:
return tree.ParseDPGLSN(string(*d))
Expand Down

0 comments on commit 1ea9749

Please sign in to comment.