Skip to content

InsertManyTx and scheduled_at #502

Closed

Description

@ligustah

Hey,

not sure if this is intentional, but when inserting jobs using InsertManyTx it seems that the scheduled_at column is set to 0001-01-01 00:00:00.000000 +00:00. It's not a big deal, I think, but makes for somewhat awkward views in the UI:
image

I'm guessing I could explicitly set those with the InsertOpts, but thought it might be easier to have the same default behavior that I get when just inserting a single job.

Activity

  1. self-assigned this
    on Aug 5, 2024
  2. bgentry commented on Aug 5, 2024

    @bgentry
    Contributor

    Thanks for reporting. This is likely a bug, the behavior should be the same here for InsertTx + InsertManyTx.

  3. bgentry commented on Aug 5, 2024

    @bgentry
    Contributor

    @ligustah actually, I'm not able to reproduce this. I wrote a test which passes nil InsertOpts to InsertManyTx, and one which passes an empty &InsertOpts{}—both of them correctly write a default timestamp of now() to the database.

    Do you have any code you can share to help understand how this is being used? Also, are you using the pgxv5 driver or database/sql?

  4. ligustah commented on Aug 5, 2024

    @ligustah
    Author

    Interesting. I'm using the database/sql driver to insert the jobs and the pgx for the workers. Let me see if I can create a minimal reproduction. Will report back.

  5. bgentry commented on Aug 5, 2024

    @bgentry
    Contributor

    @ligustah I think this is specific to database/sql and is a gap in the driver test suite. Compare the dbsql implementation to the pgx one.

    Should be able to get a fix up later today. As a quick workaround, you can set time.Now() explicitly, but we'll have this fixed soon.

  6. added 4 commits that reference this issue on Aug 5, 2024
    9911e85
    efeeebc
    aaf8a18
    2d410d4
  7. bgentry commented on Aug 5, 2024

    @bgentry
    Contributor

    Should be fixed in #504 and the next release ✌️

  8. ligustah commented on Aug 5, 2024

    @ligustah
    Author

    Amazing, thanks for the quick fix 🙏

  9. brandur commented on Aug 6, 2024

    @brandur
    Contributor

    Fix released in v0.11.1.

  10. added a commit that references this issue on Aug 7, 2024
    410482a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions