H2 postgresql 方言不能与 using 关键字一起使用

发布于 2025-01-10 12:01:47 字数 598 浏览 1 评论 0原文

我正在尝试将 postgres 数据库中的 text 类型列转换为 oid 类型,如下所示

ALTER TABLE person ALTER COLUMN id TYPE oid USING id::oid; <--works in postgresql

但我们使用 h2 进行测试 < code>postgresql dialect 并且它不喜欢 using 键。如果我删除 using 关键字,则查询可以在 h2 中工作,但不能在 postgres

ALTER TABLE person ALTER COLUMN id TYPE oid; <--works in h2

工作 问题

  1. 任何方式我都可以在没有 的情况下在 postgresql 中进行此转换using 关键字
  2. 或者有什么方法可以让 h2 识别 using 关键字?

I am trying to cast a text type column in my postgres database to oid type with something like this

ALTER TABLE person ALTER COLUMN id TYPE oid USING id::oid; <--works in postgresql

But we use h2 for our testing with postgresql dialect and it is not liking the using key. If I remove the using keyword the query works in h2 but not in postgres

ALTER TABLE person ALTER COLUMN id TYPE oid; <--works in h2

Questions

  1. Any way I can do this casting in postgresql without using keyword
  2. OR any way I can make h2 recognize using keyword ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

日记撕了你也走了 2025-01-17 12:01:47

根据 提交看起来像是对 using< 的支持/code> 关键字在以下版本中添加

version-2.1.210  version-2.0.206 version-2.0.204 version-2.0.202

As per this commit looks like support for using keyword was added in following versions

version-2.1.210  version-2.0.206 version-2.0.204 version-2.0.202
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文