Modify

Opened 4 years ago

Last modified 2 years ago

#7975 new defect

Subscription.add and Subscription._update_priority incorrectly use CURRENT_TIMESTAMP on BIGINT column

Reported by: anonymous Owned by: hasienda
Priority: normal Component: AnnouncerPlugin
Severity: major Keywords: database API
Cc: Trac Release: 0.12

Description

The subscription table columns time and changetime are BIGINT as per most of the rest of Trac, which stores time data as microseconds since Unix epoch. However, AnnouncerPlugin uses CURRENT_TIMESTAMP when inserting the data, which returns an ISO-8601 string, and this is not appropriate for the given column type. With MySQL backend, MySQL silently mangles the data to “2010”; with PostgreSQL backend, an error is raised (cannot cast type timestamp with time zone to bigint). This means the plugin does not work at all on Postgres, and works incorrectly on MySQL.

Attachments (0)

Change History (7)

comment:1 follow-up: Changed 4 years ago by doki_pen

A tested patch would be great. I don't have a mysql trac instance to test on. I can test on postgres and sqlite though.

comment:2 Changed 2 years ago by rjollos

#8065 closed as a duplicate, and it has a patch which we may want to review.

comment:3 in reply to: ↑ 1 Changed 2 years ago by hasienda

  • Keywords database API added
  • Severity changed from normal to major

Replying to doki_pen:

A tested patch would be great. I don't have a mysql trac instance to test on. I can test on postgres and sqlite though.

Me too, but since the patch in #8065 looks promising, I feel more confident for resolution than Robert did before.

comment:4 Changed 2 years ago by hasienda

Hint: We actually have to deal with the fix for #7823 here.

comment:5 Changed 2 years ago by hasienda

(In [12302]) TracAnnouncer: Part 7 of 7 - Finally: Go from present to future, refs #5774, #7975, #8065, #9742 and #10384.

Now we've bridged the gap and provide an upgrade path for each historic schema revision of this plugin, while data migration is incomplete yet, especially regarding subscription attributes stored in session_attribute (before v3). Due to component name changes the conversion will be rather complicated, and therefore corresponding research and development is postponed to a future date and will largely depend on explicite demand as well.

comment:6 Changed 2 years ago by hasienda

(In [12303]) TracAnnouncer: Convert type to match db table definitions, refs #7975, #8065 and #10384.

These changes are based on work by olistudent, Stephen Anderson and rea. I made sure, that we respect PEP8 as well, at least as far as Trac core does.

Thanks to all of you for testing, reports and suggestions towards a portable fix, and - ultimately - patience to get it finally resolved.

comment:7 Changed 2 years ago by doki_pen

  • Owner changed from doki_pen to hasienda

Add Comment

Modify Ticket

Action
as new The owner will remain hasienda.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.