title: PostgreSQL "forgets" default schema when closing data source connection
body: <p>I am running into a very strange issue with Spring Boot and Spring Data: after I manually close a connection, the formerly working application seems to &quot;forget&quot; which schema it's using and complains about missing relations.</p>
  <p>Here's the code snippet in question:</p>
  <pre><code>try (Connection connection = this.dataSource.getConnection()) {
    ScriptUtils.executeSqlScript(connection, new ClassPathResource(&quot;/script.sql&quot;));
  }
  </code></pre>
  <p>This code works fine, but after it executes, the application immediately starts throwing errors like the following:</p>
  <pre><code>org.postgresql.util.PSQLException: ERROR: relation &quot;some_table&quot; does not exist
  </code></pre>
  <p>Prior to executing the code above, the application works fine (including referencing the table it later complains about). If I remove the try-resource block, and do not close the Connection, everything also works fine, except that I've now created a resource leak. I have also tried explicitly setting the default schema (public) in the following ways:</p>
  <ul>
  <li>In the JDBC URL with the <code>currentSchema</code> parameter</li>
  <li>With the the <code>spring.datasource.hikari.schema</code> parameter</li>
  <li>With the <code>spring.datasource.jpa.properties.hibernate.default_schema</code> property</li>
  </ul>
  <p>The last does alleviate the issue with respect to Hibernate managed classes, but the issue persists with native queries. I could, of course, make the schema explicit in those queries, but that doesn't seem to address the root issue. Why would closing a connection trigger this behavior?</p>
  <p>My environment:</p>
  <ul>
  <li>Spring Boot 2.5.1</li>
  <li>PostgreSQL 12.7</li>
  </ul>