Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10071 closed (fixed)

month and day lookup arguments should be integers

Reported by: leosoto Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords: jython
Cc: jacob Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

On [8131] we forgot to normalize month and day lookups to be passed as a consistent type to the backend. Later, on [8494] and [8526] they were normalized as unicode, apparently to avoid problems with SQLite.

This is a problem for backends which are strict in terms of the argument data types. Specifically, on PostgreSQL and JDBC, it doesn't work if you compare the year of a date column against an string. Also, I don't see how to fix the problem on the backend layer, as it doesn't seem to have a chance to do the needed type conversion.

Now, considering than months and day numbers are, well, numbers, int sounds like a better type than unicode for interfacing with the backend. The attached patch does this change, without breaking the sqlite3 backend.

Attachments (2)

month_and_day_lookups_as_ints.diff (1.0 KB) - added by leosoto 5 years ago.
10071-month_day_weekday_lookups_as_ints-r10454.diff (1.5 KB) - added by ramiro 5 years ago.
Updated Leo's patch to post-week_day lookup adition (r9818)

Download all attachments as: .zip

Change History (9)

Changed 5 years ago by leosoto

comment:1 Changed 5 years ago by leosoto

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 5 years ago by russellm

  • Component changed from Uncategorized to Database layer (models, ORM)

comment:4 Changed 5 years ago by leosoto

  • Cc jacob added

Just a reminder that this is an important bug on jython and should be backported to the next 1.0.X release

Changed 5 years ago by ramiro

Updated Leo's patch to post-week_day lookup adition (r9818)

comment:5 Changed 5 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [10530]) Fixed #10071 -- Changed some internal database data representations.

We now pass numbers used in data queries as actualy numbers (integers) to the
database backends, rather than string forms. This is easier for some of the
less flexible backeds.

Based on a patch from Leo Soto and Ramiro Morales.

comment:6 Changed 5 years ago by mtredinnick

(In [10531]) [1.0.X] Fixed #10071 -- Changed some internal database data representations.

We now pass numbers used in data queries as actualy numbers (integers) to the
database backends, rather than string forms. This is easier for some of the
less flexible backeds.

Patch from Leo Soto.

Backport of r10530 from trunk.

comment:7 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


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

 
Note: See TracTickets for help on using tickets.