Removing publicly-writable schemas from search_path with ECPG

From: PG Doc comments form <noreply(at)postgresql(dot)org>
To: pgsql-docs(at)lists(dot)postgresql(dot)org
Cc: lance(dot)robson(at)gmail(dot)com
Subject: Removing publicly-writable schemas from search_path with ECPG
Date: 2025-08-08 05:14:56
Message-ID: 175463009658.797.7673870651535719486@wrigleys.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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.

Browse pgsql-docs by date

  From Date Subject
Next Message Fujii Masao 2025-08-08 15:26:02 Re: Make pgoutput documentation easier to find
Previous Message Tom Lane 2025-08-07 22:06:01 Re: add alias FLOAT for double precision