﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32653	Quoting names in the Oracle backend is not consistent with the db_table generation.	Javier Buzzi	Mariusz Felisiak	"''Original discussion can be found here: https://groups.google.com/g/django-developers/c/f3Z0AchkdyU/m/q0puWHYOCgAJ''

I have a model with a really long name think `ThisIsAReallyLongModelNameThatIsAlsoVeryOld`. To complicate things further I have a Oracle instance with archival data designated with connection name `old` and a new postgres instance with the connection name `default`.

Issue i've found is that if i try and call the model `ThisIsAReallyLongModelNameThatIsAlsoVeryOld.objects.using('old').count()` i get an error saying that the table `APP_THISISAREALLYLONGMODEL5300` does not exist, when it should be using `APP_THISISAREALLYLONGMODEL5BD6` instead. When postgres is used it works as expected: `ThisIsAReallyLongModelNameThatIsAlsoVeryOld.objects.using('default').count()`

This is because the default connection is used when the model is instantiated, and then its used from that moment on.

https://github.com/django/django/blob/stable/3.2.x/django/db/models/options.py#L207

This is an issue that seems to go back to the beginning of Django."	Bug	closed	Database layer (models, ORM)	2.2	Normal	fixed	oracle	Adam Johnson	Accepted	1	0	0	0	0	0
