<p>Just harcoding <code>DROP FUNCTION</code> does not help. We should reuse code</p>
<pre><code>diff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm
index ebe39e4..298e0cb 100644
--- a/lib/SQL/Translator/Producer/PostgreSQL.pm
+++ b/lib/SQL/Translator/Producer/PostgreSQL.pm
@@ -713,7 +713,7 @@ sub create_procedure {
 
   my @statements;
 
-  push @statements, sprintf( 'DROP FUNCTION IF EXISTS %s', $generator-&gt;quote($procedure-&gt;name) )
+  push @statements, drop_procedure( $procedure )
     if $options-&gt;{add_drop_procedure};
 
   my $sql = 'CREATE FUNCTION ';
</code></pre>
<p>otherwise we get: <code>ERROR: syntax error at end of input</code></p>
<pre><code>LINE 1: DROP FUNCTION IF EXISTS "ch_saldo"
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/dbsrgits/sql-translator/issues/82#issuecomment-275492781">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AASeAo7cv7EMqtUdmOunP1bWNhho7cQ2ks5rWPgmgaJpZM4Isz-E">mute the thread</a>.<img alt="" height="1" src="https://github.com/notifications/beacon/AASeAjMCvS_jN88qKpprd4xl6SQey5uCks5rWPgmgaJpZM4Isz-E.gif" width="1" /></p>
<div itemscope itemtype="http://schema.org/EmailMessage">
<div itemprop="action" itemscope itemtype="http://schema.org/ViewAction">
  <link itemprop="url" href="https://github.com/dbsrgits/sql-translator/issues/82#issuecomment-275492781"></link>
  <meta itemprop="name" content="View Issue"></meta>
</div>
<meta itemprop="description" content="View this Issue on GitHub"></meta>
</div>

<script type="application/json" data-scope="inboxmarkup">{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/dbsrgits/sql-translator","title":"dbsrgits/sql-translator","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/dbsrgits/sql-translator"}},"updates":{"snippets":[{"icon":"PERSON","message":"@KES777 in #82: Just harcoding `DROP FUNCTION` does not help. We should reuse code\r\n```\r\ndiff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm\r\nindex ebe39e4..298e0cb 100644\r\n--- a/lib/SQL/Translator/Producer/PostgreSQL.pm\r\n+++ b/lib/SQL/Translator/Producer/PostgreSQL.pm\r\n@@ -713,7 +713,7 @@ sub create_procedure {\r\n \r\n   my @statements;\r\n \r\n-  push @statements, sprintf( 'DROP FUNCTION IF EXISTS %s', $generator-\u003equote($procedure-\u003ename) )\r\n+  push @statements, drop_procedure( $procedure )\r\n     if $options-\u003e{add_drop_procedure};\r\n \r\n   my $sql = 'CREATE FUNCTION ';\r\n```\r\n\r\notherwise we get: `ERROR:  syntax error at end of input`\r\n\r\n    LINE 1: DROP FUNCTION IF EXISTS \"ch_saldo\"\r\n"}],"action":{"name":"View Issue","url":"https://github.com/dbsrgits/sql-translator/issues/82#issuecomment-275492781"}}}</script>