I'm guessing that you're using either MSSQL or PostgresSQL, since I believe they are the only databases that don't allow full table aliasing. As a result, Cake needs to generate the field list for SQL queries to remain consistent across all DBs. The aliasing is done from the dbosource to emulate this behaviour:
PostgresSQL: http://api.cakephp.org/1.2/class_dbo_postgres.html#ad8d52d43f8c6badcec7669a41034fa7 MSSQL: http://api.cakephp.org/1.2/class_dbo_mssql.html#da937a7ce2d9dec75ea36f3d978082a1 However, without knowing your full table schema and quite possibly the code your controller as well, it's difficult to give you a definitive answer. My best guess would be that there are some special characters in your db column names that don't play nicely with the regular expressions used to construct the SQL field list. I hope I've at least pointed you (or others) in the right direction. -Joel. On May 14, 4:21 pm, TracyB <[EMAIL PROTECTED]> wrote: > I have a model using a table that's been around forever, so it's not a > CakePHP friendly name. My model is set up like so: > > class Quote extends AppModel > { > var $name = 'Quote'; > var $useTable = 'BillOfMaterial'; > var $primaryKey = 'BillID'; > var $useDbConfig = 'design'; > > When I do a $this->Quote->findAll() or $this->paginate('Quote'), this > is the query that gets generated: > > SELECT "Quote"."BillID" AS "Quote__BillID" AS "Quote"__"BillID" AS > "Quote__BillID" AS "Quote"__"BillID" AS "Quote__BillID" AS > "Quote"__"BillID" AS "Quote__BillID", "Quote"."JobNumber" AS > "Quote__JobNumber" AS "Quote"__"JobNumber" AS "Quote__JobNumber" AS > "Quote"__"JobNumber" AS "Quote__JobNumber" AS "Quote"__"JobNumber" AS > "Quote__JobNumber", "Quote"."Phase" AS "Quote__Phase" AS > "Quote"__"Phase" AS "Quote__Phase" AS "Quote"__"Phase" AS > "Quote__Phase" AS "Quote"__"Phase" AS "Quote__Phase", > "Quote"."QuoteNumber" AS "Quote__QuoteNumber" AS > "Quote"__"QuoteNumber" AS "Quote__QuoteNumber" AS > "Quote"__"QuoteNumber" AS "Quote__QuoteNumber" AS > "Quote"__"QuoteNumber" AS "Quote__QuoteNumber", "Quote"."Division" AS > "Quote__Division" AS "Quote"__"Division" AS "Quote__Division" AS > "Quote"__"Division" AS "Quote__Division" AS "Quote"__"Division" AS > "Quote__Division", "Quote"."Project" AS "Quote__Project" AS > "Quote"__"Project" AS "Quote__Project" AS "Quote"__"Project" AS > "Quote__Project" AS "Quote"__"Project" AS "Quote__Project", > "Quote"."CustID" AS "Quote__CustID" AS "Quote"__"CustID" AS > "Quote__CustID" AS "Quote"__"CustID" AS "Quote__CustID" AS > "Quote"__"CustID" AS "Quote__CustID", "Quote"."Purchaser" AS > "Quote__Purchaser" AS "Quote"__"Purchaser" AS "Quote__Purchaser" AS > "Quote"__"Purchaser" AS "Quote__Purchaser" AS "Quote"__"Purchaser" AS > "Quote__Purchaser", "Quote"."Attn" AS "Quote__Attn" AS "Quote"__"Attn" > AS "Quote__Attn" AS "Quote"__"Attn" AS "Quote__Attn" AS > "Quote"__"Attn" AS "Quote__Attn", "Quote"."Fax" AS "Quote__Fax" AS > "Quote"__"Fax" AS "Quote__Fax" AS "Quote"__"Fax" AS "Quote__Fax" AS > "Quote"__"Fax" AS "Quote__Fax", "Quote"."Phone" AS "Quote__Phone" AS > "Quote"__"Phone" AS "Quote__Phone" AS "Quote"__"Phone" AS > "Quote__Phone" AS "Quote"__"Phone" AS "Quote__Phone", "Quote"."Cell" > AS "Quote__Cell" AS "Quote"__"Cell" AS "Quote__Cell" AS > "Quote"__"Cell" AS "Quote__Cell" AS "Quote"__"Cell" AS "Quote__Cell", > "Quote"."CustPO" AS "Quote__CustPO" AS "Quote"__"CustPO" AS > "Quote__CustPO" AS "Quote"__"CustPO" AS "Quote__CustPO" AS > "Quote"__"CustPO" AS "Quote__CustPO", "Quote"."IsOrder" AS > "Quote__IsOrder" AS "Quote"__"IsOrder" AS "Quote__IsOrder" AS > "Quote"__"IsOrder" AS "Quote__IsOrder" AS "Quote"__"IsOrder" AS > "Quote__IsOrder", "Quote"."IncludeDelivery" AS > "Quote__IncludeDelivery" AS "Quote"__"IncludeDelivery" AS > "Quote__IncludeDelivery" AS "Quote"__"IncludeDelivery" AS > "Quote__IncludeDelivery" AS "Quote"__"IncludeDelivery" AS > "Quote__IncludeDelivery", "Quote"."IncludeGST" AS "Quote__IncludeGST" > AS "Quote"__"IncludeGST" AS "Quote__IncludeGST" AS > "Quote"__"IncludeGST" AS "Quote__IncludeGST" AS "Quote"__"IncludeGST" > AS "Quote__IncludeGST", "Quote"."IncludePST" AS "Quote__IncludePST" AS > "Quote"__"IncludePST" AS "Quote__IncludePST" AS "Quote"__"IncludePST" > AS "Quote__IncludePST" AS "Quote"__"IncludePST" AS > "Quote__IncludePST", "Quote"."IncludeHST" AS "Quote__IncludeHST" AS > "Quote"__"IncludeHST" AS "Quote__IncludeHST" AS "Quote"__"IncludeHST" > AS "Quote__IncludeHST" AS "Quote"__"IncludeHST" AS > "Quote__IncludeHST", "Quote"."Delivery" AS "Quote__Delivery" AS > "Quote"__"Delivery" AS "Quote__Delivery" AS "Quote"__"Delivery" AS > "Quote__Delivery" AS "Quote"__"Delivery" AS "Quote__Delivery", > "Quote"."GST" AS "Quote__GST" AS "Quote"__"GST" AS "Quote__GST" AS > "Quote"__"GST" AS "Quote__GST" AS "Quote"__"GST" AS "Quote__GST", > "Quote"."PST" AS "Quote__PST" AS "Quote"__"PST" AS "Quote__PST" AS > "Quote"__"PST" AS "Quote__PST" AS "Quote"__"PST" AS "Quote__PST", > "Quote"."HST" AS "Quote__HST" AS "Quote"__"HST" AS "Quote__HST" AS > "Quote"__"HST" AS "Quote__HST" AS "Quote"__"HST" AS "Quote__HST", > "Quote"."AppliedDiscount" AS "Quote__AppliedDiscount" AS > "Quote"__"AppliedDiscount" AS "Quote__AppliedDiscount" AS > "Quote"__"AppliedDiscount" AS "Quote__AppliedDiscount" AS > "Quote"__"AppliedDiscount" AS "Quote__AppliedDiscount", > "Quote"."LastModified" AS "Quote__LastModified" AS > "Quote"__"LastModified" AS "Quote__LastModified" AS > "Quote"__"LastModified" AS "Quote__LastModified" AS > "Quote"__"LastModified" AS "Quote__LastModified", > "Quote"."LastModifiedBy" AS "Quote__LastModifiedBy" AS > "Quote"__"LastModifiedBy" AS "Quote__LastModifiedBy" AS > "Quote"__"LastModifiedBy" AS "Quote__LastModifiedBy" AS > "Quote"__"LastModifiedBy" AS "Quote__LastModifiedBy", "Quote"."Notes" > AS "Quote__Notes" AS "Quote"__"Notes" AS "Quote__Notes" AS > "Quote"__"Notes" AS "Quote__Notes" AS "Quote"__"Notes" AS > "Quote__Notes", "Quote"."FreightOption" AS "Quote__FreightOption" AS > "Quote"__"FreightOption" AS "Quote__FreightOption" AS > "Quote"__"FreightOption" AS "Quote__FreightOption" AS > "Quote"__"FreightOption" AS "Quote__FreightOption", > "Quote"."ShipWithJob" AS "Quote__ShipWithJob" AS > "Quote"__"ShipWithJob" AS "Quote__ShipWithJob" AS > "Quote"__"ShipWithJob" AS "Quote__ShipWithJob" AS > "Quote"__"ShipWithJob" AS "Quote__ShipWithJob", "Quote"."WantDate" AS > "Quote__WantDate" AS "Quote"__"WantDate" AS "Quote__WantDate" AS > "Quote"__"WantDate" AS "Quote__WantDate" AS "Quote"__"WantDate" AS > "Quote__WantDate", "Quote"."USFunds" AS "Quote__USFunds" AS > "Quote"__"USFunds" AS "Quote__USFunds" AS "Quote"__"USFunds" AS > "Quote__USFunds" AS "Quote"__"USFunds" AS "Quote__USFunds", > "Quote"."Exchange" AS "Quote__Exchange" AS "Quote"__"Exchange" AS > "Quote__Exchange" AS "Quote"__"Exchange" AS "Quote__Exchange" AS > "Quote"__"Exchange" AS "Quote__Exchange", "Quote"."RepFee" AS > "Quote__RepFee" AS "Quote"__"RepFee" AS "Quote__RepFee" AS > "Quote"__"RepFee" AS "Quote__RepFee" AS "Quote"__"RepFee" AS > "Quote__RepFee", "Quote"."PaymentTerms" AS "Quote__PaymentTerms" AS > "Quote"__"PaymentTerms" AS "Quote__PaymentTerms" AS > "Quote"__"PaymentTerms" AS "Quote__PaymentTerms" AS > "Quote"__"PaymentTerms" AS "Quote__PaymentTerms", "Quote"."QSRRef" AS > "Quote__QSRRef" AS "Quote"__"QSRRef" AS "Quote__QSRRef" AS > "Quote"__"QSRRef" AS "Quote__QSRRef" AS "Quote"__"QSRRef" AS > "Quote__QSRRef", "Quote"."CreatedOn" AS "Quote__CreatedOn" AS > "Quote"__"CreatedOn" AS "Quote__CreatedOn" AS "Quote"__"CreatedOn" AS > "Quote__CreatedOn" AS "Quote"__"CreatedOn" AS "Quote__CreatedOn", > "Quote"."BookedOn" AS "Quote__BookedOn" AS "Quote"__"BookedOn" AS > "Quote__BookedOn" AS "Quote"__"BookedOn" AS "Quote__BookedOn" AS > "Quote"__"BookedOn" AS "Quote__BookedOn", "Quote"."CreatedBy" AS > "Quote__CreatedBy" AS "Quote"__"CreatedBy" AS "Quote__CreatedBy" AS > "Quote"__"CreatedBy" AS "Quote__CreatedBy" AS "Quote"__"CreatedBy" AS > "Quote__CreatedBy", "Quote"."BookedBy" AS "Quote__BookedBy" AS > "Quote"__"BookedBy" AS "Quote__BookedBy" AS "Quote"__"BookedBy" AS > "Quote__BookedBy" AS "Quote"__"BookedBy" AS "Quote__BookedBy", > "Quote"."AMID" AS "Quote__AMID" AS "Quote"__"AMID" AS "Quote__AMID" AS > "Quote"__"AMID" AS "Quote__AMID" AS "Quote"__"AMID" AS "Quote__AMID", > "Quote"."Site" AS "Quote__Site" AS "Quote"__"Site" AS "Quote__Site" AS > "Quote"__"Site" AS "Quote__Site" AS "Quote"__"Site" AS "Quote__Site", > "Quote"."UoM" AS "Quote__UoM" AS "Quote"__"UoM" AS "Quote__UoM" AS > "Quote"__"UoM" AS "Quote__UoM" AS "Quote"__"UoM" AS "Quote__UoM", > "Quote"."BillID" AS "Quote__BillID" AS "Quote"__"BillID" AS > "Quote__BillID", "Quote"."BillID" AS "Quote__BillID" FROM > "BillOfMaterial" AS "Quote" WHERE "IsOrder" = 0 ORDER BY > "Quote"."CreatedOn" desc LIMIT 25 > > Does anyone know what is causing it to try to ALIAS every single field > 6 times to the same name? It's causing my database to choke and I > don't get any results. > > Thanks in advance, > Tracy Barker --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
