Django

Code

Ticket #5707 (closed: fixed)

Opened 7 months ago

Last modified 3 weeks ago

Aliases truncated to 64 characters on Postgres

Reported by: jhenry@theonion.com Assigned to: nobody
Component: Database wrapper Version: SVN
Keywords: qs-rf-fixed Cc:
Triage Stage: Accepted Has patch: 0
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description

With a large join or long table names, postgres will truncate the aliases of the tables to 64 characters resulting in duplicate table names on the query. This makes the query unexecutable.

One solution is to shorten long alias names. I wrote something that modifies the alias when it is produced in db/models/query.py, but unfortunately, the join conditions get the alias as well, so the change will probably have to ultimately go into the SortedDict class to truncate and make the names unique in 64 characters there.

An alternate solution would be to prefix the aliases with incrementing numbers since the truncation will still preserve unique names for the aliases.

Attachments

Change History

10/08/07 12:54:09 changed by mtredinnick

  • needs_better_patch changed.
  • component changed from Core framework to Database wrapper.
  • needs_tests changed.
  • keywords set to qs-rf-fixed.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.

This is being fixed automatically on the queryset-refactor branch. All the aliases there look like T0, T1, etc. I'll close this when the branch is merged into trunk.

04/26/08 21:50:16 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [7477]) Merged the queryset-refactor branch into trunk.

This is a big internal change, but mostly backwards compatible with existing code. Also adds a couple of new features.

Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658


Add/Change #5707 (Aliases truncated to 64 characters on Postgres)




Change Properties
Action