title: execute postgresql schema script Spring DatabasePopulator complaining Unterminated dollar quote started at position
body: <p>in my spring application i create many tables with Entity classes, and it works well. I use Spring with Hibernate, and the DB is PostgreSQL.</p>
  
  <p>then i need some functions, so i prepare an SQL script having the function code in it. the script executes in pgAdmin as well as in netbeans database service sql window.</p>
  
  <p>But it cannot be executed if i want to run the script after hibernate generates all the tables.
  for that purpose i created Beans in ApplicationContext.java</p>
  
  <pre><code>@Bean
  public DataSourceInitializer dataSourceInitializer() {
  final DataSourceInitializer initializer = new DataSourceInitializer();
  initializer.setDataSource(dataSource());
  initializer.setDatabasePopulator(databasePopulator());
  return initializer;
  }
  
  private DatabasePopulator databasePopulator() {
  final ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
  populator.addScript(schemaScript);
  return populator;
  }
  </code></pre>
  
  <p>the error i receive is </p>
  
  <pre><code>Caused by: org.postgresql.util.PSQLException: Unterminated dollar quote started at position 122 in SQL CREATE OR REPLACE FUNCTION public.populate_raw_data( source character varying, func character varying) RETURNS integer AS $BODY$ DECLARE cnt integer. Expected terminating $$
  </code></pre>
  
  <p>i've read several questions in SO, but nothing is helped so far. the postgresql driver in pom.xml is version 42.2.1</p>