Npgsql: Old floating point representation for timestamps not supported

泪湿孤枕 提交于 2020-02-28 08:58:46

问题


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).

回答1:


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.




回答2:


According to a thread here:

http://grokbase.com/t/postgresql/pgsql-general/103f2g9gsr/integer-datetime-8-2-8-4-differences

I noted this that may be helpful to you:

The first item listed under "Observe the following incompatibilities" in the 8.4 release notes is

Use 64-bit integer datetimes by default (Neil Conway)

Previously this was selected by configure's --enable-integer-datetimes option. To retain the old behavior, build with --disable-integer-datetimes.

Maybe that is helpful in figuring out how to disable/enable integer-datetime.

What version of Postgre-SQL are you on?




回答3:


Npgsql, ASP.NET Core 2.2:System.NotSupportedException: The deprecated floating-point date/time format is not supported by Npgsql.

Hi guys! I faced this problem using asp.net core 2.2. In my case I downgraded to Npgsql version 4.0.7 and this resolved my problem.



来源:https://stackoverflow.com/questions/34274236/npgsql-old-floating-point-representation-for-timestamps-not-supported

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!