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.