Opened 17 years ago

Closed 17 years ago

#3607 closed (duplicate)

db_columns problems

Reported by: Mario Gonzalez Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

*My backend is PostgreSQL*

In my models.py file I've got a class called "Respuesta_satisfaccion_general" (30 chars) and the PK is defined by a db_column attr: db_column=id_respuesta_satisfaccion_general (33 chars).

So the sequence name is going to be "otec_respuesta_satisfaccion_general_id_respuesta_satisfaccion_general_seq", it's a long string: 63 characters. Bad news, it fails: "relation doesn't exists". A very little snipet:

class Respuesta_satisfaccion_general(models.Model):
	id_respuesta_satisfaccion_general= models.AutoField(primary_key=True, db_column="id_respuesta_satisfaccion_general")
        [...]

I first place I thougth it was a django problem, however I tested on psql

SELECT currval(" otec_respuesta_satisfaccion_general_id_respuesta_satisfaccion_general_seq ");
NOTICE:  el identificador « otec_respuesta_satisfaccion_general_id_respuesta_satisfaccion_general_seq » se truncará a « otec_respuesta_satisfaccion_general_id_respuesta_satisfaccion_»
ERROR:  no existe la columna « otec_respuesta_satisfaccion_general_id_respuesta_satisfaccion_»

NOTICE translation: "otec_respuesta_satisfaccion_general_id_respuesta_satisfaccion_general_seq" will be truncated to "otec_respuesta_satisfaccion_general_id_respuesta_satisfaccion_"

So, I think must be a validation before create tables, well before generate SQL code. How did a "fixed"? I changed db_column content to something shorter.

Change History (1)

comment:1 by Simon G. <dev@…>, 17 years ago

Resolution: duplicate
Status: newclosed

Hi Mario,

This has been noticed before (#1820) and it's being worked on.

Note: See TracTickets for help on using tickets.
Back to Top