Npgsql:不支持时间戳的旧浮点表示形式 [英] Npgsql: Old floating point representation for timestamps not supported

查看:125
本文介绍了Npgsql:不支持时间戳的旧浮点表示形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经编写了一个基本脚本,用于将PostgreSQL数据库中的数据同步到另一个系统,该脚本可以在我的测试/开发环境中执行,而不会出现以下问题:

  • PostgreSQL 9.4
  • Npgsql dll版本3.0.3

一旦我们在实时生产环境中运行了脚本,就会遇到以下错误:

不支持时间戳的旧浮点表示形式"

研究该问题后,我发现这与"PostgreSQL弃用的编译时选项有关,该选项已切换为某些日期/时间字段的浮点表示形式.Npgsql(当前)不支持此模式."

  • 或者,有什么方法可以将我的Npgsql dll降级到支持此配置设置的旧版本吗?
  • 是否有必要建议使用Npgsql替代方案?我当时正在考虑将代码重构为使用ADO.NET(但不确定是否建议这样做).
  • 解决方案

    对此我不是百分百确定,但是Npgsql 2.2.7应该能够使用PostgreSQL旧式浮点格式正常工作,因为它使用文本传输以读取和写入非二进制值.这应该允许您与旧数据库进行交互.

    但是,强烈建议不要以任何方式继续使用PostgreSQL 8.3-8.3于2013年2月寿终正寝...您肯定应该尝试通过转储数据并将其还原到新版本中来迁移到9.4.环境,可能效果很好.

    还请注意,虽然新版本(如3.0.4)通常可以在9.0之前的PostgreSQL上运行-只是它们未经任何方式的测试,我们可能不会修复任何可能的不重要的错误跑过去.

    I've written a basic script that syncs data from a PostgreSQL database to another system, which executes in my test/development environment without issue, using:

    • PostgreSQL 9.4
    • Npgsql dll version 3.0.3

    Once we ran the script in the live production environment, we hit the following error:

    "Old floating point representation for timestamps not supported"

    Researching the issue, I found this is related to a "deprecated compile-time option of PostgreSQL which switches to a floating-point representation of some date/time fields. Npgsql (currently) does not support this mode."

    Here is a link to the relevant source code.

    In production, the PostgreSQL server is running version 8.3, and for internal reasons, the server manager has declined to upgrade the PostgreSQL server at this time. (Current Npgsql version doesn't officially support PosgreSQL prior to version 9. doh!)

    Question(s):

    • Is there any way to modify the PostgreSQL 8.3 "integer_datetimes" configuration setting without fully reinstalling the application or upgrading?
    • Alternately, is there any way to downgrade my Npgsql dlls to an older version where this configuration setting was supported?
    • Any recommendations for an alternative to Npgsql if necessary? I was thinking about refactoring the code to use ADO.NET (but I'm not sure if that would be recommended).

    解决方案

    I'm not one hundred percent sure about this, but Npgsql 2.2.7 should be able to work properly with the PostgreSQL legacy floating point format since it uses text transfer to read and write values not binary. This should allow you to interact with the old database.

    However, it's severely discouraged to continue using PostgreSQL 8.3 in any way - 8.3 reached its end-of-life on February 2013... You should definitely experiment with migrating to 9.4 simply by dumping the data and restoring it into the new environment, it may work well.

    Also note that while new versions, like 3.0.4, in general do work on pre-9.0 PostgreSQL - it's just that they're not tested in any way and we probably won't fix any non-trivial bugs you may run across.

    这篇关于Npgsql:不支持时间戳的旧浮点表示形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆