Skip to content

Support for Time type on Postgres 9.3 #7

@brbza

Description

@brbza

Hi! I found an issue when importing Time type on Postgres 9.3. COPY command was always complaining of missing data on the Time column, after analyzing a COPY .. TO output of a Time column I realized that this columns is represented as 8 bytes and not as 4 bytes as currently in the code.

I've forked the repo and made a commit with the change (that now is working fine for me), if you think it is valid you can merge with your repo.

Just wondering on which version of Postgres have you tested the Time type import, can you please let me know for reference?

lib/pg_data_encoder/encode_for_copy.rb:174
was

        buf = [(field.to_f * 1_000_000 - POSTGRES_EPOCH_TIME).to_i].pack("L!>")

now

        buf = [(field.to_f * 1_000_000 - POSTGRES_EPOCH_TIME).to_i].pack("Q!>")

Regards,

Carlos

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions