Re: [Apache Bloodhound] #601: ProgrammingError: column product specified more than onceLINE 1: ...tus, product, severity, keywords, cc, time, changetime, product) V... ^
#601: ProgrammingError: column product specified more than onceLINE 1: ...tus,product,severity,keywords,cc,time,changetime, product) V... ^ ---+ Reporter: ogaerick | Owner: nobody Type: defect| Status: new Priority: blocker | Milestone: Component: multiproduct |Version: 0.6.0 Resolution:| Keywords: ---+ Comment (by astaric): For qct, r1505666 removes product from args, so it is never added values dict. {{{ if fname in self.values: }}} should therefore prevent it from being added to the INSERT statement. Anyway, I have attached a [attachment:t601_r1505871_do_not_add_product_column_if_already_exists_in_insert.diff patch] for sql translator, that disables injecting a product if INSERT statement already contains it. Can you check if applying it solves the issue? -- Ticket URL: https://issues.apache.org/bloodhound/ticket/601#comment:10 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
Re: [Apache Bloodhound] #601: ProgrammingError: column product specified more than onceLINE 1: ...tus, product, severity, keywords, cc, time, changetime, product) V... ^
#601: ProgrammingError: column product specified more than onceLINE 1: ...tus,product,severity,keywords,cc,time,changetime, product) V... ^ ---+ Reporter: ogaerick | Owner: nobody Type: defect| Status: new Priority: blocker | Milestone: Component: multiproduct |Version: 0.6.0 Resolution:| Keywords: ---+ Comment (by rjollos): When I create a ticket using the quick ticket form, the following SQL is executed (`[trac] debug_sql = true`): {{{ 04:32:59 AM Trac[dbcursor] DEBUG: SQL: INSERT INTO ticket (summary,reporter,owner,description,type,status,priority,product,milestone,component,version,resolution,time,changetime, product) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,'prod1') 04:32:59 AM Trac[util] DEBUG: SQL: INSERT INTO ticket (summary,reporter,owner,description,type,status,priority,product,milestone,component,version,resolution,time,changetime, product) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,'prod1') }}} The duplication of the `product` field, caused by the addition of the `product` select in #569, doesn't seem to cause a problem with SQLite, but I'll attempt to reproduce with PostgreSQL. I'm not seeing a duplication of the `product` field for tickets created from the `/newticket` URL (i.e. the full new ticket form): {{{ 03:46:38 AM Trac[dbcursor] DEBUG: Original SQl: INSERT INTO ticket (summary,reporter,owner,descriobserving this issueption,type,status,priority,milestone,component,version,keywords,cc,time,changetime) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) 03:46:38 AM Trac[dbcursor] DEBUG: SQL: INSERT INTO ticket (summary,reporter,owner,description,type,status,priority,milestone,component,version,keywords,cc,time,changetime, product) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,'@') }}} The latter finding isn't too surprising since there shouldn't be a product select field within the `#inplace-propertyform` form. The product select should only exist on the breadcrumb. Do you see a product select field in the new ticket form when on the `/newticket` page? -- Ticket URL: https://issues.apache.org/bloodhound/ticket/601#comment:5 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
Re: [Apache Bloodhound] #601: ProgrammingError: column product specified more than onceLINE 1: ...tus, product, severity, keywords, cc, time, changetime, product) V... ^
#601: ProgrammingError: column product specified more than onceLINE 1: ...tus,product,severity,keywords,cc,time,changetime, product) V... ^ ---+ Reporter: ogaerick | Owner: nobody Type: defect| Status: new Priority: blocker | Milestone: Component: multiproduct |Version: 0.6.0 Resolution:| Keywords: ---+ Comment (by astaric): I have managed to replicate the qct problem it in postgres and commited a fix in r1505666. It fixes the issue for me. ogaerick, can you try the trunk version of bloodhound and see, if you still get the same error? -- Ticket URL: https://issues.apache.org/bloodhound/ticket/601#comment:6 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
Re: [Apache Bloodhound] #601: ProgrammingError: column product specified more than onceLINE 1: ...tus, product, severity, keywords, cc, time, changetime, product) V... ^
#601: ProgrammingError: column product specified more than onceLINE 1: ...tus,product,severity,keywords,cc,time,changetime, product) V... ^ ---+ Reporter: ogaerick | Owner: nobody Type: defect| Status: new Priority: blocker | Milestone: Component: multiproduct |Version: 0.6.0 Resolution:| Keywords: ---+ Comment (by olemis): Replying to [comment:6 astaric]: I have managed to replicate the qct problem it in postgres and commited a fix in r1505666. It fixes the issue for me. ogaerick, can you try the trunk version of bloodhound and see, if you still get the same error? I'm still getting the same error in PostgreSQL using both /qct and /newticket in product context . -- Ticket URL: https://issues.apache.org/bloodhound/ticket/601#comment:7 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
Re: [Apache Bloodhound] #601: ProgrammingError: column product specified more than onceLINE 1: ...tus, product, severity, keywords, cc, time, changetime, product) V... ^
#601: ProgrammingError: column product specified more than onceLINE 1: ...tus,product,severity,keywords,cc,time,changetime, product) V... ^ ---+ Reporter: ogaerick | Owner: nobody Type: defect| Status: new Priority: blocker | Milestone: Component: multiproduct |Version: 0.6.0 Resolution:| Keywords: ---+ Comment (by olemis): Replying to [comment:7 olemis]: Replying to [comment:6 astaric]: I have managed to replicate the qct problem it in postgres and commited a fix in r1505666. It fixes the issue for me. ogaerick, can you try the trunk version of bloodhound and see, if you still get the same error? I'm still getting the same error in PostgreSQL using both /qct and /newticket in product context . JFTR, it seems there's an `input type=hidden id=field-product name=field_product value=dataviz /` element in `form#propertyform` in /newticket page . Nevertheless, in any case backend code has to be robust so as not to fail. -- Ticket URL: https://issues.apache.org/bloodhound/ticket/601#comment:8 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
Re: [Apache Bloodhound] #601: ProgrammingError: column product specified more than onceLINE 1: ...tus, product, severity, keywords, cc, time, changetime, product) V... ^
#601: ProgrammingError: column product specified more than onceLINE 1: ...tus,product,severity,keywords,cc,time,changetime, product) V... ^ ---+ Reporter: ogaerick | Owner: nobody Type: defect| Status: new Priority: blocker | Milestone: Component: multiproduct |Version: 0.6.0 Resolution:| Keywords: ---+ Comment (by olemis): Below I explain the reason why I'm still getting the same error this side . Replying to [comment:5 rjollos]: When I create a ticket using the quick ticket form, the following SQL is executed (`[trac] debug_sql = true`): {{{ 04:32:59 AM Trac[dbcursor] DEBUG: SQL: INSERT INTO ticket (summary,reporter,owner,description,type,status,priority,product,milestone,component,version,resolution,time,changetime, product) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,'prod1') 04:32:59 AM Trac[util] DEBUG: SQL: INSERT INTO ticket (summary,reporter,owner,description,type,status,priority,product,milestone,component,version,resolution,time,changetime, product) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,'prod1') }}} The duplication of the `product` field, caused by the addition of the `product` select in #569, doesn't seem to cause a problem with SQLite, but I'll attempt to reproduce with PostgreSQL. I'm not seeing a duplication of the `product` field for tickets created from the `/newticket` URL (i.e. the full new ticket form): {{{ 03:46:38 AM Trac[dbcursor] DEBUG: Original SQl: INSERT INTO ticket (summary,reporter,owner,descriobserving this issueption,type,status,priority,milestone,component,version,keywords,cc,time,changetime) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s) 03:46:38 AM Trac[dbcursor] DEBUG: SQL: INSERT INTO ticket (summary,reporter,owner,description,type,status,priority,milestone,component,version,keywords,cc,time,changetime, product) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,'@') }}} Unfortunately `INSERT` statements are not logged in my instance . I can only see lines for `SELECT` statements . I'd appreciate if you share any ideas . The latter finding isn't too surprising since there shouldn't be a product select field within the `#inplace-propertyform` form. The product select should only exist on the breadcrumb. Do you see a product select field in the new ticket form when on the `/newticket` page? As far as I can tell it always inserts product field twice my side . I reproduced the sequence of invocations leading to the error in `trac.ticket.model.Ticket` and this is what I get {{{#!py from trac.env import open_environment as oe genv = oe('/path/to/blood-hound.net') from multiproduct.env import ProductEnvironment as PE penv = PE(genv, 'dataviz') from multiproduct.dbcursor import translate_sql # Headless test mode ;) sql = translate_sql(penv, INSERT INTO ticket (summary, product) VALUES ('S', 'swlcu')) sql uINSERT INTO ticket (summary, product, product) VALUES ('S', 'swlcu','dataviz') from trac.ticket.model import Ticket t = Ticket(penv) self = t # Copy and paste lines 226-235 in trac/ticket/model.py if True: ... std_fields = [] ... custom_fields = [] ... for f in self.fields: ... fname = f['name'] ... if fname in self.values: ... if f.get('custom'): ... custom_fields.append(fname) ... else: ... std_fields.append(fname) ... # The query in lines 238-241 orig = (INSERT INTO ticket (%s) VALUES (%s) ...% (','.join(std_fields), ... ','.join(['%s'] * len(std_fields orig 'INSERT INTO ticket (owner,type,priority,product,version) VALUES (%s,%s,%s,%s,%s)' sql = translate_sql(penv, orig) sql uINSERT INTO ticket (owner,type,priority,product,version, product) VALUES (%s,%s,%s,%s,%s,'dataviz') }}} `product` appears twice because 1. it is included in `std_fields` via ITicketFieldsProvider 2. and appended once again after translation All this happens using PostgreSQL backend . -- Ticket URL: https://issues.apache.org/bloodhound/ticket/601#comment:9 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker
Re: [Apache Bloodhound] #601: ProgrammingError: column product specified more than onceLINE 1: ...tus, product, severity, keywords, cc, time, changetime, product) V... ^
#601: ProgrammingError: column product specified more than onceLINE 1: ...tus,product,severity,keywords,cc,time,changetime, product) V... ^ + Reporter: ogaerick | Owner: nobody Type: defect | Status: new Priority: blocker| Milestone: Component: dashboard |Version: 0.6.0 Resolution: | Keywords: + Changes (by ogaerick): * version: = 0.6.0 -- Ticket URL: https://issues.apache.org/bloodhound/ticket/601#comment:1 Apache Bloodhound https://issues.apache.org/bloodhound/ The Apache Bloodhound issue tracker