agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: PG Doc comments form <noreply@postgresql.org>
To: pgsql-docs@lists.postgresql.org
Cc: lance.robson@gmail.com
Subject: Removing publicly-writable schemas from search_path with ECPG
Date: Fri, 08 Aug 2025 05:14:56 +0000
Message-ID: <175463009658.797.7673870651535719486@wrigleys.postgresql.org> (raw)

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/ecpg-connect.html
Description:

Hello,

This comment relates to the last paragraph of section 34.2.1 of the Postgres
16 documentation.

I am learning to use ECPG and trying to follow best practices.

After connecting to my database, I am trying to remove publicly-writable
schemas from search_path using the command "EXEC SQL SELECT
pg_catalog.set_config('search_path', '', false)".  Unfortunately, that
command seems to fail.

The following function (from section 36.8.2. of the documentation)
  void
    print_sqlca()
  {
    fprintf(stderr, "==== sqlca ====\n");
    fprintf(stderr, "sqlcode: %ld\n", sqlca.sqlcode);
    fprintf(stderr, "sqlerrm.sqlerrml: %d\n", sqlca.sqlerrm.sqlerrml);
    fprintf(stderr, "sqlerrm.sqlerrmc: %s\n", sqlca.sqlerrm.sqlerrmc);
    fprintf(stderr, "sqlerrd: %ld %ld %ld %ld %ld %ld\n",
            sqlca.sqlerrd[0],sqlca.sqlerrd[1],sqlca.sqlerrd[2],
            sqlca.sqlerrd[3],sqlca.sqlerrd[4],sqlca.sqlerrd[5]);
    fprintf(stderr, "sqlwarn: %d %d %d %d %d %d %d %d\n",
            sqlca.sqlwarn[0], sqlca.sqlwarn[1], sqlca.sqlwarn[2],
            sqlca.sqlwarn[3], sqlca.sqlwarn[4], sqlca.sqlwarn[5],
            sqlca.sqlwarn[6], sqlca.sqlwarn[7]);
    fprintf(stderr, "sqlstate: %5s\n", sqlca.sqlstate);
    fprintf(stderr, "===============\n");
  }
produces the following output:
==== sqlca ====
sqlcode: -202
sqlerrm.sqlerrml: 28
sqlerrm.sqlerrmc: too few arguments on line 25
sqlerrd: 0 0 1 0 0 0
sqlwarn: 0 0 0 0 0 0 0 0
sqlstate: 07002
===============
Line 25 of my .pgc file is where I call EXEC SQL SELECT
pg_catalog.set_config.

I would appreciate any guidance.  Please let me know if this inquiry would
be better suited for a different forum, such as stackexchange.


Message-ID: <175463009658.797.7673870651535719486@wrigleys.postgresql.org>
Permalink:  ../175463009658.797.7673870651535719486@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/175463009658.797.7673870651535719486@wrigleys.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-docs@lists.postgresql.org, lance.robson@gmail.com
  Subject: Re: Removing publicly-writable schemas from search_path with ECPG
  In-Reply-To: <175463009658.797.7673870651535719486@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox