From: Peter Rabbitson Date: Wed, 24 Jun 2009 22:43:41 +0000 (+0000) Subject: Do not cache the P::RD grammar - it breaks stuff X-Git-Tag: v0.11008~145 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9fa2a755f566794e7538ce8c4ce0dc866c8c9430;p=dbsrgits%2FSQL-Translator.git Do not cache the P::RD grammar - it breaks stuff --- diff --git a/Changes b/Changes index 361bcf8..454e0c8 100644 --- a/Changes +++ b/Changes @@ -2,6 +2,9 @@ # x.xxxxx xxxx-xx-xx # ---------------------------------------------------------- +* Fixed Pg parser - caching the compiled P::RD schema is a *very* + bad idea + # ---------------------------------------------------------- # 0.09006 2009-06-10 # ---------------------------------------------------------- diff --git a/lib/SQL/Translator/Parser/PostgreSQL.pm b/lib/SQL/Translator/Parser/PostgreSQL.pm index e14a101..5a66cec 100644 --- a/lib/SQL/Translator/Parser/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/PostgreSQL.pm @@ -121,9 +121,6 @@ $::RD_ERRORS = 1; # Make sure the parser dies when it encounters an error $::RD_WARN = 1; # Enable warnings. This will warn on unused rules &c. $::RD_HINT = 1; # Give out hints to help fix problems. -my $parser; # should we do this? There's no programmic way to - # change the grammar, so I think this is safe. - $GRAMMAR = q! { my ( %tables, @views, $table_order, $field_order, @table_comments) } @@ -1013,7 +1010,7 @@ VALUE : /[-+]?\.?\d+(?:[eE]\d+)?/ # ------------------------------------------------------------------- sub parse { my ( $translator, $data ) = @_; - $parser ||= Parse::RecDescent->new($GRAMMAR); + my $parser = Parse::RecDescent->new($GRAMMAR); $::RD_TRACE = $translator->trace ? 1 : undef; $DEBUG = $translator->debug;