Skip to main content
karuna516
Participant
July 24, 2020
Question

<cfstoredproc> call to postgreSQL giving error

  • July 24, 2020
  • 4 replies
  • 729 views

Hi,

 

We are migrating from MSSQLserver to POSTGRESQL database.We are getting column doesn't exists, even thoough column exists in the perticular table.

org.postgresql.util.PSQLException: ERROR: column "exampleid" does not exists

 

Below is the code snippet for MSSQL server

<cfstoredproc procedure="spexample" datasource="#odbc1#" returncode="Yes">
         <cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" dbvarname="@ExampleID" value="#ExampleID#">
          <cfprocparam type="Out" cfsqltype="CF_SQL_INTEGER" variable="NewExampleID" dbvarname="@oIdentity" null="No">
 </cfstoredproc>
 
Any changes need to be done for PostgreSQL?
    This topic has been closed for replies.

    4 replies

    Charlie Arehart
    Community Expert
    Community Expert
    July 28, 2020

    I want to add a couple of clarifications here, and one of them could be the solution Karuna needs.

     

    First, though: ntoe that it's NOTE that dbvarname is deprecated (as BKBK says in a comment).  Quite the contrary: it's that it IS NOW honored and must be correct, whereas it WAS literally IGNORED from about CF 7.0.2 until an update to each of CF10 and 11 a few years ago (and is still true in 2016 and 2018).

     

    And one of the things that bite people most when migrating from an older release (before 9 or without that udpate in 10 or 11) is that the dbvarname MUST have a prefix before the varname. This is a requirement of some DBs and JDBC drivers, rather than a quirk of CF.

     

    So Karuna, you are showing using an @ for the prefix in the dbvarname. That was indeed the prefix required for SQL Server (which you are migrating from). I have not found any docs to explain what PostGres uses as a prefix, if anything. (FWIW, Oracle uses an :.)

     

    So while one option is indeed to remove the dbvarname as BKBK proposes, that will then require that your cfprocparams be in the exact order the args are defined in the SP. The whole point of dbvarname is to relieve that concern, allowing used of named args.

     

    So first, try removing the @. It may be simply that Postgres uses no prefix. If that doesn't work, then try removing the dbvarname, but if it still fails then make sure you have the procparams in the right order relative to the SP.

     

    Let us know how all this goes.

    /Charlie (troubleshooter, carehart. org)
    BKBK
    Community Expert
    Community Expert
    July 26, 2020

    > Any changes need to be done for PostgreSQL?

    The following change might or might not help but is worth making: delete the attribute dbvarname. It has been deprecated.

    Just Shoot Me
    Legend
    July 24, 2020

    I moved your post over from the poorly named Community Help forum, which is for getting help using this forum system, to a better forum.


    I hope this helps. Best of luck to you.

    karuna516
    karuna516Author
    Participant
    July 24, 2020

    Thank you...

    Just Shoot Me
    Legend
    July 24, 2020

    And Exactly What Adobe program are you using?

    karuna516
    karuna516Author
    Participant
    July 24, 2020

    I am using Coldfusion 2018 and POSTGRESQL as DB on Windows server 2016 R2 OS

    BKBK
    Community Expert
    Community Expert
    July 26, 2020

    During the migration, did the column-name accidentally include a space character or quotes, perhaps?