11
11
*
12
12
*
13
13
* IDENTIFICATION
14
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.299 2002/04/01 04:35:38 tgl Exp $
14
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.300 2002/04/05 11:56:53 momjian Exp $
15
15
*
16
16
* HISTORY
17
17
* AUTHORDATEMAJOR EVENT
@@ -203,6 +203,7 @@ static bool set_name_needs_quotes(const char *name);
203
203
from_clause ,from_list ,opt_array_bounds ,qualified_name_list ,
204
204
any_name ,any_name_list ,expr_list ,dotted_name ,attrs ,
205
205
target_list ,update_target_list ,insert_column_list ,
206
+ insert_target_list ,
206
207
def_list ,opt_indirection ,group_clause ,TriggerFuncArgs ,
207
208
select_limit ,opt_select_limit
208
209
@@ -263,7 +264,7 @@ static bool set_name_needs_quotes(const char *name);
263
264
%type <node> table_ref
264
265
%type <jexpr> joined_table
265
266
%type <range> relation_expr
266
- %type <target> target_el ,update_target_el
267
+ %type <target> target_el ,insert_target_el , update_target_el
267
268
268
269
%type <typnam> Typename ,SimpleTypename ,ConstTypename
269
270
GenericType ,Numeric ,Character ,ConstDatetime ,ConstInterval ,Bit
@@ -3504,7 +3505,7 @@ InsertStmt: INSERT INTO qualified_name insert_rest
3504
3505
}
3505
3506
;
3506
3507
3507
- insert_rest :VALUES ' (' target_list ' )'
3508
+ insert_rest :VALUES ' (' insert_target_list ' )'
3508
3509
{
3509
3510
$$ = makeNode(InsertStmt);
3510
3511
$$ ->cols = NIL;
@@ -3525,7 +3526,7 @@ insert_rest: VALUES '(' target_list ')'
3525
3526
$$ ->targetList = NIL;
3526
3527
$$ ->selectStmt =$1 ;
3527
3528
}
3528
- | ' (' insert_column_list ' )' VALUES ' (' target_list ' )'
3529
+ | ' (' insert_column_list ' )' VALUES ' (' insert_target_list ' )'
3529
3530
{
3530
3531
$$ = makeNode(InsertStmt);
3531
3532
$$ ->cols =$2 ;
@@ -5244,7 +5245,6 @@ c_expr: columnref
5244
5245
s->val.type = T_String;
5245
5246
s->val.val.str =" now" ;
5246
5247
s->typename = makeTypeName(xlateSqlType(" text" ));
5247
-
5248
5248
d = makeTypeName(xlateSqlType(" timetz" ));
5249
5249
if (($3 <0 ) || ($3 >13 ))
5250
5250
elog (ERROR," CURRENT_TIME(%d) precision must be between %d and %d" ,
@@ -5721,6 +5721,23 @@ update_target_el: ColId opt_indirection '=' a_expr
5721
5721
}
5722
5722
;
5723
5723
5724
+ insert_target_list :insert_target_list ' ,' insert_target_el
5725
+ {$$ = lappend($1 ,$3 ); }
5726
+ | insert_target_el
5727
+ {$$ = makeList1($1 ); }
5728
+ ;
5729
+
5730
+ insert_target_el :target_el {$$ =$1 ; }
5731
+ | DEFAULT {
5732
+ InsertDefault *def = makeNode(InsertDefault);
5733
+ $$ = makeNode(ResTarget);
5734
+ $$ ->name =NULL ;
5735
+ $$ ->indirection =NULL ;
5736
+ $$ ->val = (Node *)def;
5737
+ }
5738
+ ;
5739
+
5740
+
5724
5741
/* ****************************************************************************
5725
5742
*
5726
5743
*Names and constants