kputnam / piggly

PL/pgSQL stored procedure code coverage tool
Other
69 stars 14 forks source link

Default arguments parse issue? #24

Closed dxlbnl closed 6 years ago

dxlbnl commented 8 years ago

Hi, I think (not sure) piggly is working fine. But maybe our SQL is too complex. You can find the sql here: https://github.com/wolbodo/pms/blob/master/database/db-logic.sql

dexter@zaphod:~/projects/wolbodo/pms$ piggly trace -d piggly.yml 
/var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/dumper/reified_procedure.rb:72:in `defaults': Couldn't parse default arguments (RuntimeError)
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/dumper/reified_procedure.rb:137:in `from_hash'
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/dumper/reified_procedure.rb:80:in `block in all'
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/dumper/reified_procedure.rb:80:in `each'
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/dumper/reified_procedure.rb:80:in `map'
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/dumper/reified_procedure.rb:80:in `all'
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/command/trace.rb:39:in `dump'
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/command/trace.rb:17:in `main'
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/lib/piggly/command/base.rb:15:in `main'
        from /var/lib/gems/2.3.0/gems/piggly-2.0.0/bin/piggly:8:in `<top (required)>'
        from /usr/local/bin/piggly:23:in `load'
        from /usr/local/bin/piggly:23:in `<main>'
kputnam commented 8 years ago

Aha, I couldn't reproduce the error from your example but I think it's caused by something I introduced recently, when procedures have zero required arguments.

Easily fixed, but I'll need to you to confirm that it fixed the issue, since you might have a different issue. When I hear from you that it works, I'll release a new gem.

Russ-K commented 8 years ago

Hi,

I seem to be having the same issue. I've tried getting and building the latest but I'm on windows and I note there is another outstanding issue around windows (https://github.com/kputnam/piggly/issues/22).

As an alternative I've tried using version 1.2.1 as I'd really like to get piggly running to see if it's something we can use - it looks like it is - but I run into issues with:

/cache.rb:23: invalid multibyte escape: /[\000-\010\016-\037\177-\300]/ (SyntaxError)

I'm not sure which is the easiest route to pursue...

Russ-K commented 7 years ago

Hi,

After finally getting around to debugging, testing changing and reverting, it looks like the only real issue is the format of the arguments.

Using piggly-2.0.0 I have now successfully run the following commands from the root of the piggly source under windows 7:

piggly trace -d "./config/database.yml"  -c "./cache"
piggly report -o "./reports" -c "./cache" -f "./trace.txt"
piggly untrace -d "./config/database.yml"  -c "./cache"

This correctly traces, reports and untraces a test stored procedure. I've yet to test this extensively but it's a promising start for running this under windows.

Thanks for all your efforts in this very useful tool.

rtaseen commented 7 years ago

Just wanted to confirm that your commit "Fix bug when parsing default arguments and none are required (GH-24)" fixed the issue for me.