Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] Incorrect table alias used in joins #13150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tremlin
Copy link

@tremlin tremlin commented Aug 15, 2016

Description of the issue/feature this PR addresses:
This PR contains the part of #1760 which has not been merged yet.

Current behavior before PR:

Suppose you have models with long names long.a and long.b where long.b inherits from long.a by _inherits. Then Odoo will generate the alias by joining the table names by two underscores. When the name exceeds the 64 character limit of PostgreSQL, Odoo will use a hash-based alias to stay within the limit. However, when preparing joins this alias is not used, which leads to broken SQL

SELECT "verylongtable111".id FROM "verylongtable3333" as "verylongtable111__verylongtable2222222222222_id__veryl_7647c3a2","verylongtable2222222222222" as "verylongtable111__verylongtable2222222222222_id","verylongtable111" WHERE ("verylongtable111"."verylongtable2222222222222_id"="verylongtable111__verylongtable2222222222222_id"."id" AND "verylongtable111__verylongtable2222222222222_id"."verylongtable3333_id"="verylongtable111__verylongtable2222222222222_id__verylongtable3333_id"."id") AND ("verylongtable111__verylongtable2222222222222_id__veryl_7647c3a2"."some_field" = 5) ORDER BY "verylongtable111"."id"  

In this case verylongtable111__verylongtable2222222222222_id__verylongtable3333_id is unknown to PostgreSQL. The alias should be used instead.

Desired behavior after PR is merged:

The correct table alias is used in all circumstances.

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@tde-banana-odoo tde-banana-odoo added the Framework General frontend/backend framework issues label Jun 7, 2017
@lathama
Copy link
Contributor

lathama commented Apr 15, 2024

@tremlin is this PR still needed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework General frontend/backend framework issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants