package SQL::Translator::Parser::PostgreSQL;
# -------------------------------------------------------------------
-# $Id: PostgreSQL.pm,v 1.44 2005-06-28 16:39:41 mwz444 Exp $
+# $Id: PostgreSQL.pm,v 1.47 2006-06-09 13:56:58 schiffbruechige Exp $
# -------------------------------------------------------------------
# Copyright (C) 2002-4 SQLFairy Authors
#
use strict;
use vars qw[ $DEBUG $VERSION $GRAMMAR @EXPORT_OK ];
-$VERSION = sprintf "%d.%02d", q$Revision: 1.44 $ =~ /(\d+)\.(\d+)/;
+$VERSION = sprintf "%d.%02d", q$Revision: 1.47 $ =~ /(\d+)\.(\d+)/;
$DEBUG = 0 unless defined $DEBUG;
use Data::Dumper;
drop : /drop/i /[^;]*/ ';'
-insert : /insert/i /[^;]*/ ';'
+string :
+ /'(\\.|''|[^\\\'])*'/
-update : /update/i /[^;]*/ ';'
+nonstring : /[^;\'"]+/
+
+statement_body : (string | nonstring)(s?)
+
+insert : /insert/i statement_body ';'
+
+update : /update/i statement_body ';'
#
# Create table.
#
-create : create_table table_name '(' create_definition(s /,/) ')' table_option(s?) ';'
+create : create_table table_name '(' create_definition(s? /,/) ')' table_option(s?) ';'
{
my $table_name = $item{'table_name'};
$tables{ $table_name }{'order'} = ++$table_order;
$return = { type => 'bytea' };
}
|
- /(timestamptz|timestamp)( with time zone)?/i
- {
- $return = { type => 'timestamp' };
- }
- |
- /(timestamptz|timestamp)( without time zone)?/i
+ /(timestamptz|timestamp)( with(out)? time zone)?/i
{
$return = { type => 'timestamp' };
}