Uploaded image for project: 'Lucee Development'
  1. LDEV-757

Returning * invalid syntax on SELECT statements with Postgres

    Details

    • Type: Bug
    • Status: Deployed
    • Priority: New
    • Resolution: Fixed
    • Affects Version/s: 5.0.0.195
    • Fix Version/s: 5.0.0.210
    • Labels:
      None

      Description

      Given the following test case Select statements sometimes failing with RETURNING is invalid syntax.

      This is because on select statements with Postgres I assume the driver is incorrectly appending RETURNING * on the end of select statements which is invalid and it should only be for insert and update

      it bizarrely does seem to vary on how you call the query for this to be a problem

      <!--- empty on purpose --->
      
      <cfset dsn = "preside">
      
      
      <cfquery datasource="#dsn#" name="qtest1">
      select 1 as Foobar
      </cfquery>
      
      <cfdump var="#qtest1#">
      
      <cfquery datasource="#dsn#" name="qtest2">
      select 2 as Foobar
      where 1 = <cfqueryparam cfsqltype="cf_sql_integer"  value="1">
      </cfquery>
      
      <cfdump var="#qtest2#">
      
      
      <cfquery datasource="#dsn#" name="qtest3" result="myresult">
      select 3 as Foobar
      where 1 = <cfqueryparam cfsqltype="cf_sql_integer"  value="1">
      </cfquery>
      
      
      <cfscript>
      
      QTest4 = queryExecute("SELECT 3 as Foobar", {}, {datasource=dsn});
      dump (qTest4);
      
      q=new query();
      q.setDatasource( dsn);
      q.setSQL( "select 1 as foobar");
      qTest4=q.Execute();
      </cfscript>
      

        Attachments

          Activity

            People

            • Assignee:
              michaeloffner Michael Offner
              Reporter:
              alexpixl8 Alex Skinner
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: