Subject: | Postgres parser: Case sensitivity issues [patch] |
I have been looking through the postgres parser and come across a number of places in the grammar where the postgres SQL commands are not assumed to be case insensitive. I attach a patch which fixes this.
Stephen Quinney
--- PostgreSQL.pm.orig 2003-08-09 16:44:17.000000000 +0100
+++ PostgreSQL.pm 2003-08-09 16:43:46.000000000 +0100
@@ -157,7 +157,7 @@
connect : /^\s*\\\connect.*\n/
-set : /SET/ /[^;]*/ ';'
+set : /SET/i /[^;]*/ ';'
revoke : /revoke/i WORD(s /,/) /on/i TABLE(?) table_name /from/i name_with_opt_quotes(s /,/) ';'
{
@@ -278,10 +278,10 @@
}
elsif ( $meta->{'type'} eq 'not_null' ) {
$null = 0;
- next;
}
elsif ( $meta->{'type'} eq 'primary_key' ) {
$is_pk = 1;
+ $null = 0;
}
push @constraints, $meta if $meta->{'supertype'} eq 'constraint';
@@ -332,10 +332,10 @@
column_constraint_type : /not null/i { $return = { type => 'not_null' } }
|
- /null/
+ /null/i
{ $return = { type => 'null' } }
|
- /unique/
+ /unique/i
{ $return = { type => 'unique' } }
|
/primary key/i
@@ -533,7 +533,7 @@
}
}
|
- /check/ '(' /(.+)/ ')'
+ /check/i '(' /(.+)/ ')'
{
$return = {
type => 'check',
@@ -674,7 +674,7 @@
{ $item[1] }
| /'.*?'/ # XXX doesn't handle embedded quotes
{ $item[1] }
- | /NULL/
+ | /NULL/i
{ 'NULL' }
!;