From: Ken Youens-Clark Date: Mon, 4 Aug 2003 15:16:13 +0000 (+0000) Subject: Applying (spirit of) patch from RT making keyword "table" optional in X-Git-Tag: v0.04~365 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0d51cd9e153c622dda8a9876fb64e2ab6a83dec7;p=dbsrgits%2FSQL-Translator.git Applying (spirit of) patch from RT making keyword "table" optional in GRANT and REVOKE commands. --- diff --git a/lib/SQL/Translator/Parser/PostgreSQL.pm b/lib/SQL/Translator/Parser/PostgreSQL.pm index c52c1c2..fbaaa1b 100644 --- a/lib/SQL/Translator/Parser/PostgreSQL.pm +++ b/lib/SQL/Translator/Parser/PostgreSQL.pm @@ -1,7 +1,7 @@ package SQL::Translator::Parser::PostgreSQL; # ------------------------------------------------------------------- -# $Id: PostgreSQL.pm,v 1.21 2003-07-11 15:22:45 kycl4rk Exp $ +# $Id: PostgreSQL.pm,v 1.22 2003-08-04 15:16:13 kycl4rk Exp $ # ------------------------------------------------------------------- # Copyright (C) 2003 Ken Y. Clark , # Allen Day , @@ -111,7 +111,7 @@ View table: use strict; use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ]; -$VERSION = sprintf "%d.%02d", q$Revision: 1.21 $ =~ /(\d+)\.(\d+)/; +$VERSION = sprintf "%d.%02d", q$Revision: 1.22 $ =~ /(\d+)\.(\d+)/; $DEBUG = 0 unless defined $DEBUG; use Data::Dumper; @@ -159,7 +159,7 @@ connect : /^\s*\\\connect.*\n/ set : /SET/ /[^;]*/ ';' -revoke : /revoke/i WORD(s /,/) /on/i /table/i table_name /from/i name_with_opt_quotes(s /,/) ';' +revoke : /revoke/i WORD(s /,/) /on/i TABLE(?) table_name /from/i name_with_opt_quotes(s /,/) ';' { my $table_name = $item{'table_name'}; push @{ $tables{ $table_name }{'permissions'} }, { @@ -169,7 +169,7 @@ revoke : /revoke/i WORD(s /,/) /on/i /table/i table_name /from/i name_with_opt_q } } -grant : /grant/i WORD(s /,/) /on/i /table/i table_name /to/i name_with_opt_quotes(s /,/) ';' +grant : /grant/i WORD(s /,/) /on/i TABLE(?) table_name /to/i name_with_opt_quotes(s /,/) ';' { my $table_name = $item{'table_name'}; push @{ $tables{ $table_name }{'permissions'} }, { @@ -613,7 +613,7 @@ alter_table : /alter/i /table/i only(?) only : /only/i -create_table : /create/i /table/i +create_table : /create/i TABLE create_index : /create/i /index/i @@ -653,6 +653,8 @@ table_option : /inherits/i '(' name_with_opt_quotes(s /,/) ')' $return = { type => $item[1] =~ /out/i ? 'without_oids' : 'with_oids' } } +TABLE : /table/i + SEMICOLON : /\s*;\n?/ WORD : /\w+/