diff -c -r postgresql-7.4.1/src/bin/psql/startup.c postgresql-7.4.1.mod/src/bin/psql/startup.c *** postgresql-7.4.1/src/bin/psql/startup.c Mon Sep 29 13:21:33 2003 --- postgresql-7.4.1.mod/src/bin/psql/startup.c Mon Feb 9 17:52:08 2004 *************** *** 98,103 **** --- 98,105 ---- char *username = NULL; char *password = NULL; + char *potential_SearchPath = NULL; + char *searchpath = NULL; bool need_pass; setlocale(LC_ALL, ""); *************** *** 209,214 **** --- 211,227 ---- PQsetNoticeProcessor(pset.db, NoticeProcessor, NULL); SyncVariables(); + + /* + * Set schema search path from environment + */ + + potential_SearchPath = getenv("PG_SCHEMA_SEARCH_PATH"); + if (potential_SearchPath != NULL) { + searchpath = (char *) palloc(sizeof("SET SEARCH_PATH TO ") + strlen(potential_SearchPath)); + sprintf(searchpath, "SET SEARCH_PATH TO %s", potential_SearchPath); + successResult = SendQuery(searchpath) ? EXIT_SUCCESS : EXIT_FAILURE; + } if (options.action == ACT_LIST_DB) {