Announcement

Collapse
No announcement yet.

How to set a schema different than "public" for postgres DB?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set a schema different than "public" for postgres DB?

    Hi everyone

    I am try to use a db connection to insert values via SC macros, because according with a tutorial, I need to use this macro "sc_commit_trans" to commit the changes and then be able to redirect to other page. My piece of code looks like this:

    $esnArray = json_decode([esnArray]);

    sc_begin_trans ("conn_oss");

    foreach($esnArray as $esnHex)
    {
    sc_exec_sql("SELECT * FROM csctoss.ops_api_expire('".$esnHex."')");
    }

    sc_commit_trans("conn_psql");

    where I am execution a Postgres DB function, but when I run this code I receive the next error: "pg_query(): Query failed: ERROR: schema "csctoss" does not exist". I guess that the error happens because I am not setting the schema on the connection and it isn't recognized. Does someone knows how to fix this?

    Thanks in advance.
Working...
X