Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

[Postgresql] pg time type error #888

Closed
Schumpeterx opened this issue Apr 24, 2024 · 1 comment
Closed

[Postgresql] pg time type error #888

Schumpeterx opened this issue Apr 24, 2024 · 1 comment
Labels
bug Something isn't working triage

Comments

@Schumpeterx
Copy link

Schumpeterx commented Apr 24, 2024

Describe the bug
I found three errors when using data-diff with Postgresql time type.

  • database prepare
    for pg and mysql
CREATE TABLE test_time2 (id int ,time_col time(3));
insert into test_time2 values(1,'08:59:59.000');

1


15:59:49 ERROR    function round(double precision, integer) does not exist                                                                         __main__.py:344
                  LINE 1: ...00:00' as time) + make_interval(0, 0, 0, 0, 0, 0, ROUND(EXTR...                                                                      
                                                                               ^                                                                                  
                  HINT:  No function matches the given name and argument types. You might need to add explicit type casts.   

when running the blow sql query in pg, it said that ERROR: function round(double precision, integer) does not exist (SQLSTATE 42883)

# data-diff output sql
 SELECT "id"::varchar, to_char(CAST('00:00:00' as time) + make_interval(0, 0, 0, 0, 0, 0, ROUND(EXTRACT( epoch from "time_col"),                 
                  3)), 'hh24:mi:ss.ff6') FROM "test_time2" WHERE ("id" >= 1) AND ("id" < 2)

That is because the type of EXTRACT( epoch from "time_col") is double precision.

  • quick fix: cast EXTRACT( epoch from "time_col") to numeric. CAST(EXTRACT( epoch from "time_col") as NUMERIC)

2

After fix the first problem, i got another one: the return time is incorrect. Time 08:59:59.000 will returned as '08:59:59.ff6

  • quick fix: change hh24:mi:ss.ff6 to hh24:mi:ss.US link

3

Besides, data-diff dose not support mysql time type now.

Describe the environment
data-diff last version: d2161cc
pg version: PostgreSQL 12.12

@Schumpeterx Schumpeterx added the bug Something isn't working label Apr 24, 2024
@Schumpeterx Schumpeterx changed the title [Postgresql] round pg time type error [Postgresql] pg time type error Apr 24, 2024
@glebmezh
Copy link
Contributor

Hi @Schumpeterx,

Thank you for trying out data-diff and for taking the time to open this issue. We made a hard decision to sunset the data-diff package and won't provide further development or support. Diffing functionality will continue to be available in Datafold Cloud. We have completely rewritten the diffing engine in the cloud over the past few months and have solved the fundamental issues with the original algorithm used in the data-diff package. Feel free to take it for a trial or contact us at [email protected] if you have any questions.

-Gleb

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working triage
Projects
None yet
Development

No branches or pull requests

2 participants