Re: Subquery has too many columns

2017-02-25 Thread eltonplima
For me it's realy a bug. I need to report them? On Tuesday, February 21, 2017 at 11:55:16 PM UTC-3, eltonplima wrote: > > I tried many things, only work if I remove the annotate or > remove base_manager_name. But I need both! > > The save method is not the problem, I removed. > > If the last cod

Re: Subquery has too many columns

2017-02-21 Thread eltonplima
I tried many things, only work if I remove the annotate or remove base_manager_name. But I need both! The save method is not the problem, I removed. If the last code I posted work, then, my production code works. PS: Sorry if my English is not very good, I'm trying to improve it. On Tuesday, F

Re: Subquery has too many columns

2017-02-21 Thread Melvyn Sopacua
While the testcase is simple, it is not the simplest test :) Two things come to mind: 1. If you get rid of the Sum(), does it work then? 2. Saving the model with the base_manager_name should not use that manager as related manager. It is only used when a model with a foreign key to Pro

Re: Subquery has too many columns

2017-02-21 Thread eltonplima
This is part of my real code but demonstrate the issue in pratice: from django.db import models class ProdutoServicoManager(models.Manager): def get_queryset(self): custo_unitario = models.F('custounitario__valor') quantidade = models.F('custounitario__quantidade') exp

Re: Subquery has too many columns

2017-02-21 Thread Melvyn Sopacua
On Monday 20 February 2017 17:09:40 eltonplima wrote: > Base class is abstract. > > class Base(models.Model): > plano = models.ForeignKey(Plano) > > > class Meta: > abstract = True > > > base_manager_name >

Re: Subquery has too many columns

2017-02-20 Thread eltonplima
Base class is abstract. class Base(models.Model): plano = models.ForeignKey(Plano) class Meta: abstract = True base_manager_name On Saturday, February 18, 2017 at 9:20:03 PM UTC-3, Melvyn Sopacua

Re: Subquery has too many columns

2017-02-18 Thread Melvyn Sopacua
On Saturday 18 February 2017 22:27:46 Elton Pereira wrote: > class ProdutoServicoManager(models.Manager): > def get_queryset(self): > expression = models.Sum(models.F('custounitario__valor') * > models.F('custounitario__quantidade')) > total_expr = models.ExpressionWrapper(expr

Subquery has too many columns

2017-02-18 Thread Elton Pereira
When I change the *base_manager_name* and try to update the model an exception is raised . This is my code: class ProdutoServicoManager(models.Manager): def get_queryset(self): expression = models.Sum(models.F('custounitario__valor') * models.F('custounit

Re: DatabaseError: subquery has too many columns

2010-07-26 Thread gs794
ld(max_length=20) objects = QuerySetManager() class QuerySet(NewNoneQuerySet): pass TestNone.objects.none() No output of 'NewNone\n\n\n\n'... Using the inherited method in other tests... Is there something special about the none method? Thanks for the help guys. On Jul 26,

Re: DatabaseError: subquery has too many columns

2010-07-25 Thread Ogi Vranesic
Obviously the subquery has too many columns, namely two: "error_test"."id", and "error_test"."name", but you want that only "error_test"."id" is NOT in select elements of the subquery. I'm not even sure that your approch make

Re: DatabaseError: subquery has too many columns

2010-07-25 Thread Dennis Kaarsemaker
On zo, 2010-07-25 at 03:16 -0700, gs794 wrote: > pks = Test.objects.none().values('pk').query > print Test.objects.exclude(pk__in=pks) You're not supposed to do that. Try without the .query, and without the .values('pk'). -- Dennis K. They've gone to plaid! -- You received this message becaus

DatabaseError: subquery has too many columns

2010-07-25 Thread gs794
Hi all, Just came across this error. class Test(models.Model): name = models.CharField(max_length=20) test = Test(name='bob') test.save() pks = Test.objects.none().values('pk').query print Test.objects.exclude(pk__in=pks) DatabaseError: subquery has too many columns

Re: Subquery has too many columns

2009-03-14 Thread timc3
Well I fixed this by updating to the latest django trunk. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from th

Subquery has too many columns

2009-03-14 Thread timc3
.connection.cursor() -> 1752 cursor.execute(sql, params) 1753 1754 if not result_type: /usr/lib/python2.5/site-packages/django/db/backends/util.py in execute (self, sql, params) 17 start = time() 18 try:

Re: subquery has too many columns

2009-01-08 Thread timc3
> > We'll need a bit more information here, since the devil's always in the > details. At a minimum, what is the output of > >         groupmembers.query.as_sql() > > There may be a problem with exclude and nested querysets. I just > realised I haven't explicitly tested those. > > Also, which dat

Re: subquery has too many columns

2009-01-07 Thread Malcolm Tredinnick
On Wed, 2009-01-07 at 09:36 -0800, timc3 wrote: [...] > ProgrammingError: subquery has too many columns > > > It seems that this query is creating the problem: > > groupmembers = requestedgroup.group_members.exclude > (id__in=groupadmins) We'll need a bit more i

Re: subquery has too many columns

2009-01-07 Thread Alex Koshelev
And what is `groupadmins`? On Wed, Jan 7, 2009 at 8:36 PM, timc3 wrote: > > I updated my django version to revision 9710 today and now I am > getting the following error message on screen: > > Caught an exception while rendering: subquery has too many columns > >

subquery has too many columns

2009-01-07 Thread timc3
I updated my django version to revision 9710 today and now I am getting the following error message on screen: Caught an exception while rendering: subquery has too many columns This is the traceback: Original Traceback (most recent call last): File "/Library/Frameworks/Python.fram