[DBIx-Class-Devel] [dbsrgits/sql-translator] PostgreSQL: add support for TRIGGERs and FUNCTIONs (#82)

Eugen Konkov notifications at github.com
Sat Jan 21 14:58:29 GMT 2017


I have found problem. `DROP FUNCTION` does not work

PostgreSQL requires parameters should be specified. This is copy/paste from `create_procedure`
```
git diff -b -w --ignore-blank-lines lib/SQL/Translator/Producer/PostgreSQL.pm
diff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm
index 9f8f727..d1de659 100644
--- a/lib/SQL/Translator/Producer/PostgreSQL.pm
+++ b/lib/SQL/Translator/Producer/PostgreSQL.pm
@@ -763,6 +763,16 @@ sub drop_procedure {
     my $generator = _generator($options);
 
     my $out = "DROP FUNCTION " . $generator->quote($procedure->name);
+    $out .= ' (';
+    my @args = ();
+    foreach my $arg (@{$procedure->parameters}) {
+    $arg = {name => $arg} if ref($arg) ne 'HASH';
+    push @args, join(' ', map $arg->{$_},
+                          grep defined($arg->{$_}),
+                          qw/argmode name type/);
+    }
+    $out .= join(', ', @args);
+    $out .= ')';
 
     return $out;
 }
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/dbsrgits/sql-translator/issues/82#issuecomment-274266587
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scsys.co.uk/pipermail/dbix-class-devel/attachments/20170121/959caaa6/attachment.htm>


More information about the DBIx-Class-Devel mailing list